yootd 0.0.1
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/LICENSE +21 -0
- package/README.md +43 -0
- package/dist/Preview/assets/phonebg.png +0 -0
- package/dist/Preview/components/icons/AdaptIcon.d.ts +3 -0
- package/dist/Preview/components/icons/AdaptIcon.js +60 -0
- package/dist/Preview/components/icons/MagnifyIcon.d.ts +3 -0
- package/dist/Preview/components/icons/MagnifyIcon.js +40 -0
- package/dist/Preview/components/icons/ResetIcon.d.ts +3 -0
- package/dist/Preview/components/icons/ResetIcon.js +66 -0
- package/dist/Preview/components/icons/ShrinkIcon.d.ts +3 -0
- package/dist/Preview/components/icons/ShrinkIcon.js +40 -0
- package/dist/Preview/components/preview/phone.d.ts +7 -0
- package/dist/Preview/components/preview/phone.js +10 -0
- package/dist/Preview/components/preview/phone.scss +8 -0
- package/dist/Preview/components/preview/web.d.ts +6 -0
- package/dist/Preview/components/preview/web.js +10 -0
- package/dist/Preview/components/reactflow/Controls.d.ts +5 -0
- package/dist/Preview/components/reactflow/Controls.js +69 -0
- package/dist/Preview/components/reactflow/TopPreview.d.ts +5 -0
- package/dist/Preview/components/reactflow/TopPreview.js +28 -0
- package/dist/Preview/index.d.ts +5 -0
- package/dist/Preview/index.js +94 -0
- package/dist/Preview/index.scss +35 -0
- package/dist/Preview/types/type.d.ts +21 -0
- package/dist/affix/index.d.ts +3 -0
- package/dist/affix/index.js +2 -0
- package/dist/alert/index.d.ts +5 -0
- package/dist/alert/index.js +2 -0
- package/dist/anchor/index.d.ts +10 -0
- package/dist/anchor/index.js +18 -0
- package/dist/anchor/index.scss +23 -0
- package/dist/app/index.d.ts +5 -0
- package/dist/app/index.js +2 -0
- package/dist/approval-process/components/Avatar.d.ts +3 -0
- package/dist/approval-process/components/Avatar.js +100 -0
- package/dist/approval-process/components/BackOut.d.ts +3 -0
- package/dist/approval-process/components/BackOut.js +35 -0
- package/dist/approval-process/components/Failed.d.ts +3 -0
- package/dist/approval-process/components/Failed.js +37 -0
- package/dist/approval-process/components/Pending.d.ts +3 -0
- package/dist/approval-process/components/Pending.js +51 -0
- package/dist/approval-process/components/StartIcon.d.ts +3 -0
- package/dist/approval-process/components/StartIcon.js +35 -0
- package/dist/approval-process/components/Success.d.ts +3 -0
- package/dist/approval-process/components/Success.js +35 -0
- package/dist/approval-process/index.d.ts +7 -0
- package/dist/approval-process/index.js +96 -0
- package/dist/approval-process/index.scss +95 -0
- package/dist/areas/index.d.ts +4 -0
- package/dist/areas/index.js +317 -0
- package/dist/areas/index.scss +21 -0
- package/dist/areas/types/types.d.ts +39 -0
- package/dist/aside/components/AddBtnIcon.d.ts +3 -0
- package/dist/aside/components/AddBtnIcon.js +27 -0
- package/dist/aside/components/DelBtnIcon.d.ts +3 -0
- package/dist/aside/components/DelBtnIcon.js +33 -0
- package/dist/aside/components/DragBtnIcon.d.ts +3 -0
- package/dist/aside/components/DragBtnIcon.js +26 -0
- package/dist/aside/components/EditBtnIcon.d.ts +3 -0
- package/dist/aside/components/EditBtnIcon.js +33 -0
- package/dist/aside/components/SortableItem.d.ts +5 -0
- package/dist/aside/components/SortableItem.js +125 -0
- package/dist/aside/components/SortableItem.scss +93 -0
- package/dist/aside/index.d.ts +4 -0
- package/dist/aside/index.js +186 -0
- package/dist/aside/index.scss +25 -0
- package/dist/aside/types/types.d.ts +44 -0
- package/dist/auto-complete/index.d.ts +4 -0
- package/dist/auto-complete/index.js +2 -0
- package/dist/avatar/index.d.ts +3 -0
- package/dist/avatar/index.js +2 -0
- package/dist/badge/index.d.ts +11 -0
- package/dist/badge/index.js +21 -0
- package/dist/badge/index.scss +5 -0
- package/dist/breadcrumb/index.d.ts +9 -0
- package/dist/breadcrumb/index.js +10 -0
- package/dist/business-tree/components/dept.d.ts +4 -0
- package/dist/business-tree/components/dept.js +35 -0
- package/dist/business-tree/components/space.d.ts +4 -0
- package/dist/business-tree/components/space.js +48 -0
- package/dist/business-tree/index.d.ts +3 -0
- package/dist/business-tree/index.js +16 -0
- package/dist/button/index.d.ts +13 -0
- package/dist/button/index.js +54 -0
- package/dist/button/index.scss +31 -0
- package/dist/calendar/index.d.ts +3 -0
- package/dist/calendar/index.js +2 -0
- package/dist/card/index.d.ts +3 -0
- package/dist/card/index.js +2 -0
- package/dist/carousel/index.d.ts +3 -0
- package/dist/carousel/index.js +2 -0
- package/dist/cascader/index.d.ts +11 -0
- package/dist/cascader/index.js +23 -0
- package/dist/cascader/index.scss +5 -0
- package/dist/checkbox/index.d.ts +10 -0
- package/dist/checkbox/index.js +13 -0
- package/dist/collapse/index.d.ts +3 -0
- package/dist/collapse/index.js +2 -0
- package/dist/color-picker/index.d.ts +6 -0
- package/dist/color-picker/index.js +2 -0
- package/dist/config-provider/context.d.ts +8 -0
- package/dist/config-provider/context.js +2 -0
- package/dist/config-provider/index.d.ts +24 -0
- package/dist/config-provider/index.js +34 -0
- package/dist/date-interval/index.d.ts +16 -0
- package/dist/date-interval/index.js +82 -0
- package/dist/date-picker/index.d.ts +3 -0
- package/dist/date-picker/index.js +2 -0
- package/dist/date-range/index.d.ts +16 -0
- package/dist/date-range/index.js +83 -0
- package/dist/description/index.d.ts +3 -0
- package/dist/description/index.js +2 -0
- package/dist/dictionary/index.d.ts +6 -0
- package/dist/dictionary/index.js +45 -0
- package/dist/dictionary/types/types.d.ts +14 -0
- package/dist/divider/index.d.ts +4 -0
- package/dist/divider/index.js +5 -0
- package/dist/drawer/index.d.ts +3 -0
- package/dist/drawer/index.js +2 -0
- package/dist/drawer-modal/components/CloseOutlined.d.ts +7 -0
- package/dist/drawer-modal/components/CloseOutlined.js +23 -0
- package/dist/drawer-modal/index.d.ts +6 -0
- package/dist/drawer-modal/index.js +37 -0
- package/dist/drawer-modal/index.scss +39 -0
- package/dist/drawer-modal/types/types.d.ts +3 -0
- package/dist/dropdown/assets/arrow-down.svg +6 -0
- package/dist/dropdown/index.d.ts +9 -0
- package/dist/dropdown/index.js +7 -0
- package/dist/empty/assets/404.png +0 -0
- package/dist/empty/assets/empty-content.png +0 -0
- package/dist/empty/assets/empty-data.png +0 -0
- package/dist/empty/assets/image-error.png +0 -0
- package/dist/empty/assets/net-error.png +0 -0
- package/dist/empty/assets/no-collect.png +0 -0
- package/dist/empty/assets/no-news.png +0 -0
- package/dist/empty/assets/no-notice.png +0 -0
- package/dist/empty/assets/no-schedule.png +0 -0
- package/dist/empty/assets/no-search-data.png +0 -0
- package/dist/empty/assets/submit-fail.png +0 -0
- package/dist/empty/assets/submit-success.png +0 -0
- package/dist/empty/index.d.ts +12 -0
- package/dist/empty/index.js +131 -0
- package/dist/empty/index.scss +15 -0
- package/dist/flex/index.d.ts +4 -0
- package/dist/flex/index.js +5 -0
- package/dist/float-button/index.d.ts +9 -0
- package/dist/float-button/index.js +10 -0
- package/dist/form/index.d.ts +3 -0
- package/dist/form/index.js +2 -0
- package/dist/grid/index.d.ts +6 -0
- package/dist/grid/index.js +8 -0
- package/dist/group-title/index.d.ts +7 -0
- package/dist/group-title/index.js +21 -0
- package/dist/group-title/index.scss +31 -0
- package/dist/hooks/useAssets.d.ts +1 -0
- package/dist/hooks/useAssets.js +11 -0
- package/dist/hooks/useBem.d.ts +15 -0
- package/dist/hooks/useBem.js +80 -0
- package/dist/hooks/useRequest.d.ts +1 -0
- package/dist/hooks/useRequest.js +11 -0
- package/dist/image/assets/default.png +0 -0
- package/dist/image/assets/error.png +0 -0
- package/dist/image/assets/eye.png +0 -0
- package/dist/image/index.d.ts +10 -0
- package/dist/image/index.js +95 -0
- package/dist/image/index.scss +27 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.js +85 -0
- package/dist/input/index.d.ts +10 -0
- package/dist/input/index.js +24 -0
- package/dist/input/index.scss +5 -0
- package/dist/input-number/index.d.ts +3 -0
- package/dist/input-number/index.js +2 -0
- package/dist/layout/index.d.ts +6 -0
- package/dist/layout/index.js +2 -0
- package/dist/list/index.d.ts +3 -0
- package/dist/list/index.js +2 -0
- package/dist/mentions/index.d.ts +3 -0
- package/dist/mentions/index.js +2 -0
- package/dist/menu/index.d.ts +9 -0
- package/dist/menu/index.js +12 -0
- package/dist/message/index.d.ts +3 -0
- package/dist/message/index.js +2 -0
- package/dist/modal/components/header-icon.d.ts +3 -0
- package/dist/modal/components/header-icon.js +46 -0
- package/dist/modal/index.d.ts +10 -0
- package/dist/modal/index.js +41 -0
- package/dist/modal/index.scss +65 -0
- package/dist/notification/index.d.ts +3 -0
- package/dist/notification/index.js +2 -0
- package/dist/pagination/index.d.ts +5 -0
- package/dist/pagination/index.js +22 -0
- package/dist/pagination/index.scss +47 -0
- package/dist/pop-confirm/index.d.ts +3 -0
- package/dist/pop-confirm/index.js +2 -0
- package/dist/popover/index.d.ts +5 -0
- package/dist/popover/index.js +2 -0
- package/dist/progress/index.d.ts +3 -0
- package/dist/progress/index.js +2 -0
- package/dist/qrcode/index.d.ts +3 -0
- package/dist/qrcode/index.js +2 -0
- package/dist/radio/index.d.ts +4 -0
- package/dist/radio/index.js +3 -0
- package/dist/rate/index.d.ts +3 -0
- package/dist/rate/index.js +2 -0
- package/dist/result/index.d.ts +2 -0
- package/dist/result/index.js +2 -0
- package/dist/school/index.d.ts +4 -0
- package/dist/school/index.js +304 -0
- package/dist/school/index.scss +21 -0
- package/dist/school/types/types.d.ts +84 -0
- package/dist/segmented/index.d.ts +3 -0
- package/dist/segmented/index.js +2 -0
- package/dist/select/index.d.ts +3 -0
- package/dist/select/index.js +2 -0
- package/dist/skeleton/index.d.ts +9 -0
- package/dist/skeleton/index.js +2 -0
- package/dist/slider/index.d.ts +3 -0
- package/dist/slider/index.js +2 -0
- package/dist/space/index.d.ts +6 -0
- package/dist/space/index.js +2 -0
- package/dist/spin/index.d.ts +2 -0
- package/dist/spin/index.js +2 -0
- package/dist/splitter/index.d.ts +6 -0
- package/dist/splitter/index.js +2 -0
- package/dist/state/index.d.ts +8 -0
- package/dist/state/index.js +28 -0
- package/dist/state/index.scss +89 -0
- package/dist/statistic/index.d.ts +2 -0
- package/dist/statistic/index.js +2 -0
- package/dist/steps/index.d.ts +10 -0
- package/dist/steps/index.js +18 -0
- package/dist/steps/index.scss +32 -0
- package/dist/switch/index.d.ts +3 -0
- package/dist/switch/index.js +2 -0
- package/dist/table/components/icons/DownOutlined.d.ts +3 -0
- package/dist/table/components/icons/DownOutlined.js +28 -0
- package/dist/table/components/icons/DragHandler.d.ts +3 -0
- package/dist/table/components/icons/DragHandler.js +24 -0
- package/dist/table/components/icons/SettingFilled.d.ts +3 -0
- package/dist/table/components/icons/SettingFilled.js +22 -0
- package/dist/table/components/icons/UpOutlined.d.ts +3 -0
- package/dist/table/components/icons/UpOutlined.js +28 -0
- package/dist/table/components/primary-header-row/index.d.ts +3 -0
- package/dist/table/components/primary-header-row/index.js +130 -0
- package/dist/table/components/primary-header-row/index.scss +58 -0
- package/dist/table/components/primary-tbody-row/index.d.ts +3 -0
- package/dist/table/components/primary-tbody-row/index.js +40 -0
- package/dist/table/components/primary-tbody-row/index.scss +5 -0
- package/dist/table/index.d.ts +41 -0
- package/dist/table/index.js +146 -0
- package/dist/table/index.module.scss +9 -0
- package/dist/table/index.scss +33 -0
- package/dist/tabs/index.d.ts +12 -0
- package/dist/tabs/index.js +108 -0
- package/dist/tabs/index.scss +50 -0
- package/dist/tag/index.d.ts +2 -0
- package/dist/tag/index.js +2 -0
- package/dist/teacher/index.d.ts +3 -0
- package/dist/teacher/index.js +59 -0
- package/dist/teacher/types/types.d.ts +31 -0
- package/dist/time-picker/index.d.ts +3 -0
- package/dist/time-picker/index.js +2 -0
- package/dist/timeline/index.d.ts +5 -0
- package/dist/timeline/index.js +2 -0
- package/dist/tooltip/index.d.ts +5 -0
- package/dist/tooltip/index.js +2 -0
- package/dist/tour/index.d.ts +5 -0
- package/dist/tour/index.js +2 -0
- package/dist/transfer/index.d.ts +3 -0
- package/dist/transfer/index.js +2 -0
- package/dist/tree/components/BedIcon.d.ts +3 -0
- package/dist/tree/components/BedIcon.js +29 -0
- package/dist/tree/components/CampusIcon.d.ts +3 -0
- package/dist/tree/components/CampusIcon.js +30 -0
- package/dist/tree/components/DeptIcon.d.ts +3 -0
- package/dist/tree/components/DeptIcon.js +32 -0
- package/dist/tree/components/FloorIcon.d.ts +3 -0
- package/dist/tree/components/FloorIcon.js +32 -0
- package/dist/tree/components/RoomIcon.d.ts +3 -0
- package/dist/tree/components/RoomIcon.js +32 -0
- package/dist/tree/components/SchoolIcon.d.ts +3 -0
- package/dist/tree/components/SchoolIcon.js +70 -0
- package/dist/tree/components/TierlIcon.d.ts +3 -0
- package/dist/tree/components/TierlIcon.js +39 -0
- package/dist/tree/index.d.ts +27 -0
- package/dist/tree/index.js +207 -0
- package/dist/tree/index.scss +25 -0
- package/dist/tree-select/index.d.ts +3 -0
- package/dist/tree-select/index.js +2 -0
- package/dist/typography/index.d.ts +3 -0
- package/dist/typography/index.js +2 -0
- package/dist/upload/assets/again.png +0 -0
- package/dist/upload/assets/delete.png +0 -0
- package/dist/upload/assets/success.png +0 -0
- package/dist/upload/components/AgainIcon.d.ts +3 -0
- package/dist/upload/components/AgainIcon.js +29 -0
- package/dist/upload/components/DeleteIcon.d.ts +3 -0
- package/dist/upload/components/DeleteIcon.js +28 -0
- package/dist/upload/components/DeleteImage.d.ts +3 -0
- package/dist/upload/components/DeleteImage.js +47 -0
- package/dist/upload/components/SuccessIcon.d.ts +3 -0
- package/dist/upload/components/SuccessIcon.js +28 -0
- package/dist/upload/components/UpLoadIconAdd.d.ts +3 -0
- package/dist/upload/components/UpLoadIconAdd.js +28 -0
- package/dist/upload/components/UploadIcon.d.ts +3 -0
- package/dist/upload/components/UploadIcon.js +36 -0
- package/dist/upload/components/fileUpload.d.ts +13 -0
- package/dist/upload/components/fileUpload.js +258 -0
- package/dist/upload/components/imageUpload.d.ts +13 -0
- package/dist/upload/components/imageUpload.js +243 -0
- package/dist/upload/index.d.ts +20 -0
- package/dist/upload/index.js +16 -0
- package/dist/upload/index.scss +115 -0
- package/dist/user-dropdown/index.d.ts +3 -0
- package/dist/user-dropdown/index.js +101 -0
- package/dist/user-dropdown/types/types.d.ts +44 -0
- package/dist/utils/types.d.ts +7 -0
- package/dist/utils/types.js +1 -0
- package/dist/utils/utils.d.ts +2 -0
- package/dist/utils/utils.js +12 -0
- package/dist/watermark/index.d.ts +3 -0
- package/dist/watermark/index.js +2 -0
- package/dist/year-options/index.d.ts +11 -0
- package/dist/year-options/index.js +32 -0
- package/dist/year-term/index.d.ts +4 -0
- package/dist/year-term/index.js +169 -0
- package/dist/year-term/index.scss +21 -0
- package/dist/year-term/types/types.d.ts +28 -0
- package/dist/zones/index.d.ts +3 -0
- package/dist/zones/index.js +186 -0
- package/dist/zones/index.module.scss +23 -0
- package/dist/zones/types/types.d.ts +26 -0
- package/package.json +97 -0
@@ -0,0 +1,125 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
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); }
|
3
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
4
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
5
|
+
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; }
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
8
|
+
import { useSortable } from '@dnd-kit/sortable';
|
9
|
+
import { CSS } from '@dnd-kit/utilities';
|
10
|
+
import React from 'react';
|
11
|
+
import { Switch } from "../..";
|
12
|
+
import "./SortableItem.scss";
|
13
|
+
import { useBem } from "../../hooks/useBem";
|
14
|
+
import { DelBtnIcon } from "./DelBtnIcon";
|
15
|
+
import { DragBtnIcon } from "./DragBtnIcon";
|
16
|
+
import { EditBtnIcon } from "./EditBtnIcon";
|
17
|
+
var SortableItem = function SortableItem(_ref) {
|
18
|
+
var activeKey = _ref.activeKey,
|
19
|
+
id = _ref.id,
|
20
|
+
editBtnIcon = _ref.editBtnIcon,
|
21
|
+
delBtnIcon = _ref.delBtnIcon,
|
22
|
+
switchBtnIcon = _ref.switchBtnIcon,
|
23
|
+
dragBtnIcon = _ref.dragBtnIcon,
|
24
|
+
title = _ref.title,
|
25
|
+
checked = _ref.checked,
|
26
|
+
extra = _ref.extra,
|
27
|
+
_onClick = _ref.onClick,
|
28
|
+
onEdit = _ref.onEdit,
|
29
|
+
onDel = _ref.onDel,
|
30
|
+
onSwitch = _ref.onSwitch;
|
31
|
+
var _useSortable = useSortable({
|
32
|
+
id: id
|
33
|
+
}),
|
34
|
+
attributes = _useSortable.attributes,
|
35
|
+
listeners = _useSortable.listeners,
|
36
|
+
setNodeRef = _useSortable.setNodeRef,
|
37
|
+
transform = _useSortable.transform,
|
38
|
+
transition = _useSortable.transition,
|
39
|
+
isDragging = _useSortable.isDragging;
|
40
|
+
var style = _objectSpread({
|
41
|
+
transform: CSS.Transform.toString(transform),
|
42
|
+
transition: transition
|
43
|
+
}, isDragging ? {
|
44
|
+
position: 'relative',
|
45
|
+
zIndex: 9999
|
46
|
+
} : {});
|
47
|
+
var mb = useBem('SortableItem');
|
48
|
+
var top = mb.b('content').b('top');
|
49
|
+
return /*#__PURE__*/React.createElement("div", {
|
50
|
+
style: style,
|
51
|
+
className: "".concat(mb)
|
52
|
+
}, /*#__PURE__*/React.createElement("div", {
|
53
|
+
className: "".concat(mb.b('content'), " ").concat(id === activeKey ? "".concat(mb.e('content-active')) : ''),
|
54
|
+
key: id,
|
55
|
+
onClick: function onClick() {
|
56
|
+
_onClick === null || _onClick === void 0 || _onClick(id);
|
57
|
+
}
|
58
|
+
}, /*#__PURE__*/React.createElement("div", {
|
59
|
+
className: "".concat(top)
|
60
|
+
}, /*#__PURE__*/React.createElement("div", {
|
61
|
+
className: "".concat(top.b('top-left'))
|
62
|
+
}, /*#__PURE__*/React.createElement("div", _extends({
|
63
|
+
className: "".concat(top.b('top-left').b('top-drag-btn-icon')),
|
64
|
+
style: {
|
65
|
+
display: dragBtnIcon ? 'block' : 'none'
|
66
|
+
},
|
67
|
+
ref: setNodeRef
|
68
|
+
}, attributes, listeners), /*#__PURE__*/React.createElement(DragBtnIcon, {
|
69
|
+
className: "".concat(top.b('top-left').b('top-drag-btn-icon').e('drag-btn-icon-svg'))
|
70
|
+
})), /*#__PURE__*/React.createElement("div", {
|
71
|
+
className: "".concat(top.b('top-left').b('top-title-wrap'))
|
72
|
+
}, /*#__PURE__*/React.createElement("span", {
|
73
|
+
className: "".concat(top.b('top-left').b('top-title-wrap').e('top-title')),
|
74
|
+
style: {
|
75
|
+
marginRight: editBtnIcon || delBtnIcon ? '12px' : '0',
|
76
|
+
marginLeft: dragBtnIcon ? '6px' : '0'
|
77
|
+
}
|
78
|
+
}, title))), /*#__PURE__*/React.createElement("div", {
|
79
|
+
className: "".concat(top.b('top-middle')),
|
80
|
+
style: {
|
81
|
+
marginLeft: editBtnIcon || delBtnIcon ? '12px' : 0
|
82
|
+
}
|
83
|
+
}, /*#__PURE__*/React.createElement("div", {
|
84
|
+
className: "".concat(top.b('top-middle').b('top-edit-btn-icon')),
|
85
|
+
style: {
|
86
|
+
opacity: id === activeKey ? 1 : 0,
|
87
|
+
display: editBtnIcon ? 'block' : 'none'
|
88
|
+
},
|
89
|
+
onClick: function onClick() {
|
90
|
+
return onEdit === null || onEdit === void 0 ? void 0 : onEdit(id);
|
91
|
+
}
|
92
|
+
}, /*#__PURE__*/React.createElement(EditBtnIcon, {
|
93
|
+
className: "".concat(top.b('top-middle').b('top-edit-btn-icon').e('edit-btn-icon-svg'))
|
94
|
+
})), /*#__PURE__*/React.createElement("div", {
|
95
|
+
className: "".concat(top.b('top-middle').b('top-del-btn-icon')),
|
96
|
+
style: {
|
97
|
+
opacity: id === activeKey ? 1 : 0,
|
98
|
+
display: delBtnIcon ? 'block' : 'none'
|
99
|
+
},
|
100
|
+
onClick: function onClick() {
|
101
|
+
return onDel === null || onDel === void 0 ? void 0 : onDel(id);
|
102
|
+
}
|
103
|
+
}, /*#__PURE__*/React.createElement(DelBtnIcon, {
|
104
|
+
className: "".concat(top.b('top-middle').b('top-del-btn-icon').e('del-btn-icon-svg'))
|
105
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
106
|
+
style: {
|
107
|
+
display: switchBtnIcon ? 'block' : 'none',
|
108
|
+
marginLeft: switchBtnIcon ? '12px' : '0'
|
109
|
+
}
|
110
|
+
}, /*#__PURE__*/React.createElement(Switch, {
|
111
|
+
size: "small",
|
112
|
+
checked: checked,
|
113
|
+
onChange: function onChange(e) {
|
114
|
+
onSwitch === null || onSwitch === void 0 || onSwitch(id, e);
|
115
|
+
}
|
116
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
117
|
+
className: "".concat(mb.b('content').b('bottom')),
|
118
|
+
style: {
|
119
|
+
marginLeft: dragBtnIcon ? '22px' : '0'
|
120
|
+
}
|
121
|
+
}, /*#__PURE__*/React.createElement("span", {
|
122
|
+
className: "".concat(mb.b('content').b('bottom').e('extra'))
|
123
|
+
}, extra))));
|
124
|
+
};
|
125
|
+
export default SortableItem;
|
@@ -0,0 +1,93 @@
|
|
1
|
+
.yot-SortableItem {
|
2
|
+
&-content {
|
3
|
+
position: relative;
|
4
|
+
padding: 12px 16px;
|
5
|
+
box-sizing: border-box;
|
6
|
+
cursor: pointer;
|
7
|
+
&-top {
|
8
|
+
display: flex;
|
9
|
+
justify-content: space-between;
|
10
|
+
align-items: start;
|
11
|
+
&-top-left {
|
12
|
+
display: flex;
|
13
|
+
align-items: start;
|
14
|
+
&-top-drag-btn-icon {
|
15
|
+
cursor: move;
|
16
|
+
&__drag-btn-icon-svg {
|
17
|
+
display: inline-block;
|
18
|
+
vertical-align: middle;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
&-top-title-wrap {
|
22
|
+
display: flex;
|
23
|
+
align-items: center;
|
24
|
+
justify-content: center;
|
25
|
+
&__top-title {
|
26
|
+
font-size: 16px;
|
27
|
+
font-weight: 400;
|
28
|
+
line-height: 1.5em;
|
29
|
+
overflow: hidden;
|
30
|
+
display: -webkit-box; //将元素设为盒子伸缩模型显示
|
31
|
+
-webkit-box-orient: vertical; //伸缩方向设为垂直方向
|
32
|
+
-webkit-line-clamp: 2; //超出2行隐藏,并显示省略号
|
33
|
+
line-clamp: 2;
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
&-top-middle {
|
38
|
+
display: flex;
|
39
|
+
align-items: center;
|
40
|
+
&-top-edit-btn-icon {
|
41
|
+
cursor: pointer;
|
42
|
+
&__edit-btn-icon-svg {
|
43
|
+
display: inline-block;
|
44
|
+
vertical-align: middle;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
&-top-del-btn-icon {
|
48
|
+
cursor: pointer;
|
49
|
+
margin-left: 12px;
|
50
|
+
&__del-btn-icon-svg {
|
51
|
+
display: inline-block;
|
52
|
+
vertical-align: middle;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}
|
56
|
+
}
|
57
|
+
&-bottom {
|
58
|
+
text-overflow: ellipsis;
|
59
|
+
overflow: hidden;
|
60
|
+
white-space: nowrap;
|
61
|
+
&__extra {
|
62
|
+
font-size: 12px;
|
63
|
+
font-weight: 400;
|
64
|
+
color: rgba(0, 0, 0, 0.45);
|
65
|
+
}
|
66
|
+
}
|
67
|
+
}
|
68
|
+
&-content:hover {
|
69
|
+
background-color: #d1eaff;
|
70
|
+
transition: all 0.05s ease;
|
71
|
+
}
|
72
|
+
&-content::before {
|
73
|
+
content: '';
|
74
|
+
position: absolute;
|
75
|
+
bottom: -0.5px;
|
76
|
+
left: 16px;
|
77
|
+
right: 16px;
|
78
|
+
height: 1px;
|
79
|
+
background-color: #e5e5e5;
|
80
|
+
}
|
81
|
+
&__content-active {
|
82
|
+
background-color: #d1eaff;
|
83
|
+
}
|
84
|
+
&__content-active::after {
|
85
|
+
content: '';
|
86
|
+
position: absolute;
|
87
|
+
bottom: 0;
|
88
|
+
left: 0;
|
89
|
+
width: 4px;
|
90
|
+
height: 100%;
|
91
|
+
background-color: #4d8de2;
|
92
|
+
}
|
93
|
+
}
|
@@ -0,0 +1,186 @@
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
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(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
6
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
7
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
8
|
+
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."); }
|
9
|
+
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); }
|
10
|
+
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; }
|
11
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
12
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
13
|
+
import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from '@dnd-kit/core';
|
14
|
+
import { SortableContext, arrayMove, sortableKeyboardCoordinates, verticalListSortingStrategy } from '@dnd-kit/sortable';
|
15
|
+
import React, { useEffect, useState } from 'react';
|
16
|
+
import { useBem } from "../hooks/useBem";
|
17
|
+
import { AddBtnIcon } from "./components/AddBtnIcon";
|
18
|
+
import SortableItem from "./components/SortableItem";
|
19
|
+
import "./index.scss";
|
20
|
+
export var Aside = function Aside(_ref) {
|
21
|
+
var _ref$width = _ref.width,
|
22
|
+
width = _ref$width === void 0 ? 300 : _ref$width,
|
23
|
+
_ref$height = _ref.height,
|
24
|
+
height = _ref$height === void 0 ? '100%' : _ref$height,
|
25
|
+
style = _ref.style,
|
26
|
+
activeKey = _ref.activeKey,
|
27
|
+
title = _ref.title,
|
28
|
+
data = _ref.data,
|
29
|
+
_ref$titleShow = _ref.titleShow,
|
30
|
+
titleShow = _ref$titleShow === void 0 ? true : _ref$titleShow,
|
31
|
+
_ref$addBtnIcon = _ref.addBtnIcon,
|
32
|
+
addBtnIcon = _ref$addBtnIcon === void 0 ? false : _ref$addBtnIcon,
|
33
|
+
_ref$editBtnIcon = _ref.editBtnIcon,
|
34
|
+
editBtnIcon = _ref$editBtnIcon === void 0 ? false : _ref$editBtnIcon,
|
35
|
+
_ref$delBtnIcon = _ref.delBtnIcon,
|
36
|
+
delBtnIcon = _ref$delBtnIcon === void 0 ? false : _ref$delBtnIcon,
|
37
|
+
_ref$switchBtnIcon = _ref.switchBtnIcon,
|
38
|
+
switchBtnIcon = _ref$switchBtnIcon === void 0 ? false : _ref$switchBtnIcon,
|
39
|
+
_ref$dragBtnIcon = _ref.dragBtnIcon,
|
40
|
+
dragBtnIcon = _ref$dragBtnIcon === void 0 ? false : _ref$dragBtnIcon,
|
41
|
+
onClick = _ref.onClick,
|
42
|
+
onAdd = _ref.onAdd,
|
43
|
+
onEdit = _ref.onEdit,
|
44
|
+
onDel = _ref.onDel,
|
45
|
+
onSwitch = _ref.onSwitch,
|
46
|
+
onDragEnd = _ref.onDragEnd;
|
47
|
+
var mb = useBem('aside');
|
48
|
+
// 当前选择的key
|
49
|
+
var _useState = useState(),
|
50
|
+
_useState2 = _slicedToArray(_useState, 2),
|
51
|
+
key = _useState2[0],
|
52
|
+
setKey = _useState2[1];
|
53
|
+
// 缓存传入的数据
|
54
|
+
var _useState3 = useState([]),
|
55
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
56
|
+
dataValue = _useState4[0],
|
57
|
+
setDataValue = _useState4[1];
|
58
|
+
var sensors = useSensors(useSensor(PointerSensor, {
|
59
|
+
activationConstraint: {
|
60
|
+
delay: 50,
|
61
|
+
tolerance: 10
|
62
|
+
}
|
63
|
+
}), useSensor(KeyboardSensor, {
|
64
|
+
coordinateGetter: sortableKeyboardCoordinates
|
65
|
+
}));
|
66
|
+
// 切换选中项
|
67
|
+
var handleClick = function handleClick(key) {
|
68
|
+
if (key != null) {
|
69
|
+
setKey(key);
|
70
|
+
onClick === null || onClick === void 0 || onClick(key);
|
71
|
+
}
|
72
|
+
};
|
73
|
+
// 添加
|
74
|
+
var handleAdd = function handleAdd() {
|
75
|
+
onAdd === null || onAdd === void 0 || onAdd();
|
76
|
+
};
|
77
|
+
// 编辑
|
78
|
+
var handleEdit = function handleEdit(key) {
|
79
|
+
onEdit === null || onEdit === void 0 || onEdit(key);
|
80
|
+
};
|
81
|
+
// 删除
|
82
|
+
var handleDel = function handleDel(key) {
|
83
|
+
onDel === null || onDel === void 0 || onDel(key);
|
84
|
+
};
|
85
|
+
// 开关
|
86
|
+
var handleSwitch = function handleSwitch(key, e) {
|
87
|
+
setDataValue(function (pre) {
|
88
|
+
var newData = pre === null || pre === void 0 ? void 0 : pre.map(function (item) {
|
89
|
+
if (item.key !== key) {
|
90
|
+
return item;
|
91
|
+
} else {
|
92
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
93
|
+
checked: e
|
94
|
+
});
|
95
|
+
}
|
96
|
+
});
|
97
|
+
onSwitch === null || onSwitch === void 0 || onSwitch({
|
98
|
+
key: key,
|
99
|
+
checked: e
|
100
|
+
}, newData);
|
101
|
+
return newData;
|
102
|
+
});
|
103
|
+
};
|
104
|
+
// 排序
|
105
|
+
var handleDragEnd = function handleDragEnd(event) {
|
106
|
+
var active = event.active,
|
107
|
+
over = event.over;
|
108
|
+
if (over == null) {
|
109
|
+
return;
|
110
|
+
}
|
111
|
+
if (active.id !== over.id) {
|
112
|
+
var oldIndex = dataValue === null || dataValue === void 0 ? void 0 : dataValue.findIndex(function (item) {
|
113
|
+
return item.key === active.id;
|
114
|
+
});
|
115
|
+
var newIndex = dataValue === null || dataValue === void 0 ? void 0 : dataValue.findIndex(function (item) {
|
116
|
+
return item.key === over.id;
|
117
|
+
});
|
118
|
+
var _data = arrayMove(dataValue, oldIndex, newIndex);
|
119
|
+
setDataValue(_data);
|
120
|
+
onDragEnd === null || onDragEnd === void 0 || onDragEnd(_data);
|
121
|
+
}
|
122
|
+
};
|
123
|
+
|
124
|
+
// 给key设置初始值
|
125
|
+
useEffect(function () {
|
126
|
+
if (activeKey) {
|
127
|
+
setKey(activeKey);
|
128
|
+
} else {
|
129
|
+
var _data$;
|
130
|
+
setKey(data === null || data === void 0 || (_data$ = data[0]) === null || _data$ === void 0 ? void 0 : _data$.key);
|
131
|
+
}
|
132
|
+
}, [activeKey]);
|
133
|
+
// 给数组设置初始值
|
134
|
+
useEffect(function () {
|
135
|
+
if (data != null && (data === null || data === void 0 ? void 0 : data.length) > 0) {
|
136
|
+
setDataValue(data);
|
137
|
+
}
|
138
|
+
}, [data]);
|
139
|
+
return /*#__PURE__*/React.createElement("div", {
|
140
|
+
className: "".concat(mb),
|
141
|
+
style: _objectSpread(_objectSpread({}, style), {}, {
|
142
|
+
width: width,
|
143
|
+
height: height
|
144
|
+
})
|
145
|
+
}, titleShow && /*#__PURE__*/React.createElement("div", {
|
146
|
+
className: "".concat(mb.b('title'))
|
147
|
+
}, /*#__PURE__*/React.createElement("span", {
|
148
|
+
className: "".concat(mb.b('title').e('title-text'))
|
149
|
+
}, title), /*#__PURE__*/React.createElement("div", {
|
150
|
+
className: "".concat(mb.b('title').e('add-btn-icon')),
|
151
|
+
style: {
|
152
|
+
display: addBtnIcon ? 'block' : 'none',
|
153
|
+
marginLeft: addBtnIcon ? '16px' : '0px'
|
154
|
+
},
|
155
|
+
onClick: handleAdd
|
156
|
+
}, /*#__PURE__*/React.createElement(AddBtnIcon, null))), /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(DndContext, {
|
157
|
+
sensors: sensors,
|
158
|
+
collisionDetection: closestCenter,
|
159
|
+
onDragEnd: function onDragEnd(e) {
|
160
|
+
handleDragEnd(e);
|
161
|
+
}
|
162
|
+
}, /*#__PURE__*/React.createElement(SortableContext, {
|
163
|
+
items: dataValue === null || dataValue === void 0 ? void 0 : dataValue.map(function (item) {
|
164
|
+
return item.key;
|
165
|
+
}),
|
166
|
+
strategy: verticalListSortingStrategy
|
167
|
+
}, dataValue === null || dataValue === void 0 ? void 0 : dataValue.map(function (item) {
|
168
|
+
var _dataValue$;
|
169
|
+
return /*#__PURE__*/React.createElement(SortableItem, {
|
170
|
+
key: item.key,
|
171
|
+
activeKey: key !== null && key !== void 0 ? key : dataValue === null || dataValue === void 0 || (_dataValue$ = dataValue[0]) === null || _dataValue$ === void 0 ? void 0 : _dataValue$.key,
|
172
|
+
title: item.title,
|
173
|
+
extra: item.extra,
|
174
|
+
id: item.key,
|
175
|
+
editBtnIcon: editBtnIcon,
|
176
|
+
delBtnIcon: delBtnIcon,
|
177
|
+
switchBtnIcon: switchBtnIcon,
|
178
|
+
dragBtnIcon: dragBtnIcon,
|
179
|
+
checked: item.checked,
|
180
|
+
onClick: handleClick,
|
181
|
+
onEdit: handleEdit,
|
182
|
+
onDel: handleDel,
|
183
|
+
onSwitch: handleSwitch
|
184
|
+
});
|
185
|
+
})))));
|
186
|
+
};
|
@@ -0,0 +1,25 @@
|
|
1
|
+
.yot-aside {
|
2
|
+
background-color: #ffffff;
|
3
|
+
border-radius: 8px;
|
4
|
+
box-sizing: border-box;
|
5
|
+
&-title {
|
6
|
+
border-bottom: 1px solid #e5e5e5;
|
7
|
+
padding: 16px 0px;
|
8
|
+
margin: 0px 16px;
|
9
|
+
box-sizing: border-box;
|
10
|
+
display: flex;
|
11
|
+
align-items: start;
|
12
|
+
justify-content: space-between;
|
13
|
+
&__title-text {
|
14
|
+
font-size: 18px;
|
15
|
+
font-weight: bold;
|
16
|
+
overflow: hidden;
|
17
|
+
text-overflow: ellipsis;
|
18
|
+
white-space: nowrap;
|
19
|
+
}
|
20
|
+
&__add-btn-icon {
|
21
|
+
cursor: pointer;
|
22
|
+
margin-top: 8px;
|
23
|
+
}
|
24
|
+
}
|
25
|
+
}
|
@@ -0,0 +1,44 @@
|
|
1
|
+
type IdataItem = {
|
2
|
+
key: string;
|
3
|
+
title: string;
|
4
|
+
extra?: string;
|
5
|
+
checked?: boolean;
|
6
|
+
};
|
7
|
+
export type AsideProps = {
|
8
|
+
width?: number;
|
9
|
+
height?: number | string;
|
10
|
+
style?: React.CSSProperties;
|
11
|
+
activeKey?: string;
|
12
|
+
title?: string;
|
13
|
+
data: IdataItem[];
|
14
|
+
titleShow?: boolean;
|
15
|
+
addBtnIcon?: boolean;
|
16
|
+
editBtnIcon?: boolean;
|
17
|
+
delBtnIcon?: boolean;
|
18
|
+
switchBtnIcon?: boolean;
|
19
|
+
dragBtnIcon?: boolean;
|
20
|
+
onClick?: (key: string) => void;
|
21
|
+
onAdd?: () => void;
|
22
|
+
onEdit?: (key: string) => void;
|
23
|
+
onDel?: (key: string) => void;
|
24
|
+
onSwitch?: (
|
25
|
+
changeValue: { key: string; checked: boolean },
|
26
|
+
data: IdataItem[],
|
27
|
+
) => void;
|
28
|
+
onDragEnd?: (data: IdataItem[]) => void;
|
29
|
+
};
|
30
|
+
export type AsideItemProps = {
|
31
|
+
activeKey: string;
|
32
|
+
id: string;
|
33
|
+
title: string;
|
34
|
+
editBtnIcon?: boolean;
|
35
|
+
delBtnIcon?: boolean;
|
36
|
+
switchBtnIcon?: boolean;
|
37
|
+
dragBtnIcon?: boolean;
|
38
|
+
checked?: boolean;
|
39
|
+
extra?: string;
|
40
|
+
onClick?: (key: string) => void;
|
41
|
+
onEdit?: (key: string) => void;
|
42
|
+
onDel?: (key: string) => void;
|
43
|
+
onSwitch?: (key: string, e: boolean) => void;
|
44
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { BadgeProps } from 'antd';
|
2
|
+
import React from 'react';
|
3
|
+
import Ribbon from 'antd/es/badge/Ribbon';
|
4
|
+
import './index.scss';
|
5
|
+
export type { ScrollNumberProps } from 'antd/es/badge';
|
6
|
+
export type { BadgeProps };
|
7
|
+
type BadgeType = typeof BadgeComponent & {
|
8
|
+
Ribbon: typeof Ribbon;
|
9
|
+
};
|
10
|
+
export declare const BadgeComponent: React.ForwardRefExoticComponent<BadgeProps & React.RefAttributes<HTMLSpanElement>>;
|
11
|
+
export declare const Badge: BadgeType;
|
@@ -0,0 +1,21 @@
|
|
1
|
+
var _excluded = ["className"];
|
2
|
+
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); }
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
|
+
import { Badge as AntBadge } from 'antd';
|
6
|
+
import React, { forwardRef } from 'react';
|
7
|
+
import Ribbon from 'antd/es/badge/Ribbon';
|
8
|
+
import { useBem } from "../hooks/useBem";
|
9
|
+
import "./index.scss";
|
10
|
+
export var BadgeComponent = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
11
|
+
var className = _ref.className,
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
13
|
+
var mb = useBem('badge');
|
14
|
+
return /*#__PURE__*/React.createElement(AntBadge, _extends({
|
15
|
+
ref: ref,
|
16
|
+
className: "".concat(mb, " ").concat(className !== null && className !== void 0 ? className : '')
|
17
|
+
}, props));
|
18
|
+
});
|
19
|
+
export var Badge = BadgeComponent;
|
20
|
+
Badge.displayName = 'Badge';
|
21
|
+
Badge.Ribbon = Ribbon;
|
@@ -0,0 +1,9 @@
|
|
1
|
+
import type { BreadcrumbProps as AntBreadcrumbProps } from 'antd';
|
2
|
+
import { Breadcrumb as AntBreadcrumb } from 'antd';
|
3
|
+
import React from 'react';
|
4
|
+
export type BreadcrumbProps = AntBreadcrumbProps;
|
5
|
+
type AntBreadcrumbType = typeof AntBreadcrumb;
|
6
|
+
export type BreadcrumbType = typeof BreadcrumbComponent & Pick<AntBreadcrumbType, "Item" | "Separator">;
|
7
|
+
declare const BreadcrumbComponent: React.FC<BreadcrumbProps>;
|
8
|
+
export declare const Breadcrumb: BreadcrumbType;
|
9
|
+
export {};
|
@@ -0,0 +1,10 @@
|
|
1
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
2
|
+
import { Breadcrumb as AntBreadcrumb } from 'antd';
|
3
|
+
import React from 'react';
|
4
|
+
var BreadcrumbComponent = function BreadcrumbComponent(_ref) {
|
5
|
+
var rest = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
6
|
+
return /*#__PURE__*/React.createElement(AntBreadcrumb, rest);
|
7
|
+
};
|
8
|
+
export var Breadcrumb = BreadcrumbComponent;
|
9
|
+
Breadcrumb.Item = AntBreadcrumb.Item;
|
10
|
+
Breadcrumb.Separator = AntBreadcrumb.Separator;
|
@@ -0,0 +1,35 @@
|
|
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
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure " + obj); }
|
3
|
+
import { useQuery } from '@tanstack/react-query';
|
4
|
+
import React, { useMemo } from 'react';
|
5
|
+
import { Tree } from "../..";
|
6
|
+
import { useRequest } from "../../hooks/useRequest";
|
7
|
+
var App = function App(_ref) {
|
8
|
+
var props = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
|
9
|
+
var request = useRequest();
|
10
|
+
var _useQuery = useQuery({
|
11
|
+
queryKey: ['depts'],
|
12
|
+
queryFn: function queryFn() {
|
13
|
+
return request({
|
14
|
+
url: "/v1/depts",
|
15
|
+
method: 'GET',
|
16
|
+
params: {
|
17
|
+
as_tree: true
|
18
|
+
}
|
19
|
+
});
|
20
|
+
}
|
21
|
+
}),
|
22
|
+
queryDepts = _useQuery.data;
|
23
|
+
var treeData = useMemo(function () {
|
24
|
+
if (queryDepts !== null && queryDepts !== void 0 && queryDepts.content) {
|
25
|
+
var jsonStr = JSON.stringify(queryDepts.content);
|
26
|
+
var formatted = jsonStr.replace(/"deptName":/g, '"title":').replace(/"deptId":/g, '"key":');
|
27
|
+
return JSON.parse(formatted);
|
28
|
+
}
|
29
|
+
}, [queryDepts]);
|
30
|
+
return /*#__PURE__*/React.createElement(Tree, _extends({
|
31
|
+
treeData: treeData,
|
32
|
+
showIcon: true
|
33
|
+
}, props));
|
34
|
+
};
|
35
|
+
export default App;
|
@@ -0,0 +1,48 @@
|
|
1
|
+
var _excluded = ["depth", "notRequireSchool", "areaType", "areaSubType", "requireLastLevel"];
|
2
|
+
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); }
|
3
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
4
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
5
|
+
import { useQuery } from '@tanstack/react-query';
|
6
|
+
import React, { useMemo } from 'react';
|
7
|
+
import { Tree } from "../..";
|
8
|
+
import { useRequest } from "../../hooks/useRequest";
|
9
|
+
var App = function App(_ref) {
|
10
|
+
var depth = _ref.depth,
|
11
|
+
notRequireSchool = _ref.notRequireSchool,
|
12
|
+
areaType = _ref.areaType,
|
13
|
+
areaSubType = _ref.areaSubType,
|
14
|
+
_ref$requireLastLevel = _ref.requireLastLevel,
|
15
|
+
requireLastLevel = _ref$requireLastLevel === void 0 ? false : _ref$requireLastLevel,
|
16
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
17
|
+
var request = useRequest();
|
18
|
+
var _useQuery = useQuery({
|
19
|
+
queryKey: ['areas'],
|
20
|
+
queryFn: function queryFn() {
|
21
|
+
return request({
|
22
|
+
url: "/v1/areas",
|
23
|
+
method: 'GET',
|
24
|
+
params: {
|
25
|
+
as_tree: true,
|
26
|
+
depth: depth,
|
27
|
+
not_require_school: notRequireSchool,
|
28
|
+
area_type: areaType,
|
29
|
+
area_sub_type: areaSubType,
|
30
|
+
require_last_level: requireLastLevel
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
}),
|
35
|
+
queryAreas = _useQuery.data;
|
36
|
+
var treeData = useMemo(function () {
|
37
|
+
if (queryAreas !== null && queryAreas !== void 0 && queryAreas.content) {
|
38
|
+
var jsonStr = JSON.stringify(queryAreas.content);
|
39
|
+
var formatted = jsonStr.replace(/"areaName":/g, '"title":').replace(/"areaId":/g, '"key":');
|
40
|
+
return JSON.parse(formatted);
|
41
|
+
}
|
42
|
+
}, [queryAreas]);
|
43
|
+
return /*#__PURE__*/React.createElement(Tree, _extends({
|
44
|
+
treeData: treeData,
|
45
|
+
showIcon: true
|
46
|
+
}, props));
|
47
|
+
};
|
48
|
+
export default App;
|