yootd 0.0.47 → 0.0.49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dropdown-select/assets/ArrowDown.d.ts +3 -0
- package/dist/dropdown-select/assets/ArrowDown.js +29 -0
- package/dist/dropdown-select/index.d.ts +4 -0
- package/dist/dropdown-select/index.js +59 -0
- package/dist/dropdown-select/index.scss +6 -0
- package/dist/dropdown-select/types/type.d.ts +18 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/upload/index.d.ts +6 -1
- package/dist/upload/index.js +3 -2
- package/package.json +1 -1
@@ -0,0 +1,29 @@
|
|
1
|
+
var _excluded = ["style", "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 React, { forwardRef } from 'react';
|
6
|
+
export var ArrowDown = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
7
|
+
var style = _ref.style,
|
8
|
+
className = _ref.className,
|
9
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
10
|
+
return /*#__PURE__*/React.createElement("svg", _extends({
|
11
|
+
ref: ref
|
12
|
+
}, rest, {
|
13
|
+
style: style,
|
14
|
+
className: className,
|
15
|
+
width: "16",
|
16
|
+
height: "16",
|
17
|
+
viewBox: "0 0 16 16",
|
18
|
+
fill: "none",
|
19
|
+
xmlns: "http://www.w3.org/2000/svg"
|
20
|
+
}), /*#__PURE__*/React.createElement("g", {
|
21
|
+
id: "chevron-left"
|
22
|
+
}, /*#__PURE__*/React.createElement("path", {
|
23
|
+
id: "union",
|
24
|
+
d: "M12.46 6.4603L11.5407 5.54106L8.00034 9.08144L4.45996 5.54106L3.54072 6.4603L8.00034 10.9199L12.46 6.4603Z",
|
25
|
+
fill: "black",
|
26
|
+
"fill-opacity": "0.45"
|
27
|
+
})));
|
28
|
+
});
|
29
|
+
ArrowDown.displayName = 'ArrowDown';
|
@@ -0,0 +1,59 @@
|
|
1
|
+
var _excluded = ["items", "arrow", "defaultValue", "onChange"];
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
4
|
+
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."); }
|
5
|
+
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); }
|
6
|
+
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; }
|
7
|
+
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; } }
|
8
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
9
|
+
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; }
|
10
|
+
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; }
|
11
|
+
import { Dropdown } from 'antd';
|
12
|
+
import React, { useEffect, useState } from 'react';
|
13
|
+
import { useBem } from "../hooks/useBem";
|
14
|
+
import { ArrowDown } from "./assets/ArrowDown";
|
15
|
+
import "./index.scss";
|
16
|
+
export var DropdownSelect = function DropdownSelect(_ref) {
|
17
|
+
var _rest$overlayClassNam, _items$find$label, _items$find;
|
18
|
+
var items = _ref.items,
|
19
|
+
_ref$arrow = _ref.arrow,
|
20
|
+
arrow = _ref$arrow === void 0 ? true : _ref$arrow,
|
21
|
+
defaultValue = _ref.defaultValue,
|
22
|
+
onChange = _ref.onChange,
|
23
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
24
|
+
var mb = useBem('dropdownselect');
|
25
|
+
// 当前选中的key值
|
26
|
+
var _useState = useState(),
|
27
|
+
_useState2 = _slicedToArray(_useState, 2),
|
28
|
+
selected = _useState2[0],
|
29
|
+
setSelected = _useState2[1];
|
30
|
+
// 设置初始的key值
|
31
|
+
useEffect(function () {
|
32
|
+
var _items$;
|
33
|
+
if (defaultValue) {
|
34
|
+
setSelected(defaultValue);
|
35
|
+
} else if (items !== null && items !== void 0 && (_items$ = items[0]) !== null && _items$ !== void 0 && _items$.key) {
|
36
|
+
var _items$2;
|
37
|
+
setSelected(items === null || items === void 0 || (_items$2 = items[0]) === null || _items$2 === void 0 ? void 0 : _items$2.key);
|
38
|
+
} else {
|
39
|
+
setSelected(undefined);
|
40
|
+
}
|
41
|
+
}, [items]);
|
42
|
+
// 切换选中项目
|
43
|
+
var onClick = function onClick(_ref2) {
|
44
|
+
var key = _ref2.key;
|
45
|
+
setSelected(key);
|
46
|
+
onChange === null || onChange === void 0 || onChange(key);
|
47
|
+
};
|
48
|
+
return /*#__PURE__*/React.createElement(Dropdown.Button, _extends({
|
49
|
+
menu: {
|
50
|
+
items: items,
|
51
|
+
onClick: onClick
|
52
|
+
},
|
53
|
+
arrow: arrow,
|
54
|
+
overlayClassName: "".concat(mb, " ").concat((_rest$overlayClassNam = rest === null || rest === void 0 ? void 0 : rest.overlayClassName) !== null && _rest$overlayClassNam !== void 0 ? _rest$overlayClassNam : ''),
|
55
|
+
icon: /*#__PURE__*/React.createElement(ArrowDown, null)
|
56
|
+
}, rest), (_items$find$label = items === null || items === void 0 || (_items$find = items.find(function (item) {
|
57
|
+
return (item === null || item === void 0 ? void 0 : item.key) === selected;
|
58
|
+
})) === null || _items$find === void 0 ? void 0 : _items$find.label) !== null && _items$find$label !== void 0 ? _items$find$label : '');
|
59
|
+
};
|
@@ -0,0 +1,18 @@
|
|
1
|
+
export interface DropdownSelectProps {
|
2
|
+
defaultValue?: string; // 默认选中的key值
|
3
|
+
items: MenuItemType[]; // 下拉菜单
|
4
|
+
onChange?: (value: string) => void; // 选中值改变时触发
|
5
|
+
arrow?: boolean; // 下拉箭头是否显示
|
6
|
+
overlayClassName?: string; // 下拉菜单的样式
|
7
|
+
autoAdjustOverflow?: boolean; // 下拉框被遮挡时自动调整位置
|
8
|
+
autoFocus?: boolean; // 打开后自动聚焦下拉框
|
9
|
+
disabled?: boolean; // 菜单是否禁用
|
10
|
+
destroyPopupOnHide?: boolean; // 关闭后是否销毁 Dropdown
|
11
|
+
dropdownRender?: (menus: ReactNode) => ReactNode; // 自定义下拉菜单
|
12
|
+
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; // 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位
|
13
|
+
overlayClassName?: string; // 下拉菜单的样式
|
14
|
+
overlayStyle?: React.CSSProperties; // 下拉菜单的样式
|
15
|
+
placement?: 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight'; // 菜单弹出位置
|
16
|
+
trigger?: Array<click | hover | contextMenu>; // 触发下拉的行为
|
17
|
+
open?: boolean; // 菜单是否显示
|
18
|
+
}
|
package/dist/index.d.ts
CHANGED
@@ -21,6 +21,8 @@ export { Dropdown } from './dropdown';
|
|
21
21
|
export type { DropdownProps } from './dropdown';
|
22
22
|
export { Department } from './department';
|
23
23
|
export type { DepartmentProps } from './department/types/types';
|
24
|
+
export { DropdownSelect } from './dropdown-select';
|
25
|
+
export type { DropdownSelectProps } from './dropdown-select/types/type';
|
24
26
|
export { JobTitle } from './job-title';
|
25
27
|
export type { JobTitleProps } from './job-title/types/types';
|
26
28
|
export { Role } from './role';
|
package/dist/index.js
CHANGED
@@ -11,6 +11,7 @@ export { Courses } from "./courses";
|
|
11
11
|
export { Divider } from "./divider";
|
12
12
|
export { Dropdown } from "./dropdown";
|
13
13
|
export { Department } from "./department";
|
14
|
+
export { DropdownSelect } from "./dropdown-select";
|
14
15
|
export { JobTitle } from "./job-title";
|
15
16
|
export { Role } from "./role";
|
16
17
|
export { Flex } from "./flex";
|
package/dist/upload/index.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import type { UploadProps as AntUploadProps, UploadFile } from 'antd';
|
2
2
|
import React from 'react';
|
3
|
+
import { Upload as AntUpload } from 'antd';
|
3
4
|
import { UploadRef } from 'antd/es/upload/Upload';
|
4
5
|
export type { DraggerProps, RcFile, UploadChangeParam, UploadFile, UploadListProps, } from 'antd/es/upload';
|
5
6
|
export type UploadProps = AntUploadProps & {
|
@@ -12,7 +13,7 @@ export type UploadProps = AntUploadProps & {
|
|
12
13
|
fileType?: 'file' | 'image';
|
13
14
|
onChange?: (value?: UploadFile[]) => void;
|
14
15
|
};
|
15
|
-
|
16
|
+
declare const UploadInternal: React.ForwardRefExoticComponent<AntUploadProps<any> & {
|
16
17
|
maxCount?: number | undefined;
|
17
18
|
accept?: string | undefined;
|
18
19
|
folder?: string | undefined;
|
@@ -22,3 +23,7 @@ export declare const Upload: React.ForwardRefExoticComponent<AntUploadProps<any>
|
|
22
23
|
fileType?: "image" | "file" | undefined;
|
23
24
|
onChange?: ((value?: UploadFile[]) => void) | undefined;
|
24
25
|
} & React.RefAttributes<UploadRef<any>>>;
|
26
|
+
type CompoundedComponent = typeof UploadInternal & {
|
27
|
+
AntdUpload: typeof AntUpload;
|
28
|
+
};
|
29
|
+
export declare const Upload: CompoundedComponent;
|
package/dist/upload/index.js
CHANGED
@@ -5,7 +5,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
5
5
|
import React, { forwardRef } from 'react';
|
6
6
|
import FileUpload from "./components/fileUpload";
|
7
7
|
import ImageUpload from "./components/imageUpload";
|
8
|
-
|
8
|
+
var UploadInternal = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
9
9
|
var fileType = _ref.fileType,
|
10
10
|
props = _objectWithoutProperties(_ref, _excluded);
|
11
11
|
return /*#__PURE__*/React.createElement(React.Fragment, null, fileType === 'file' ? /*#__PURE__*/React.createElement(FileUpload, _extends({
|
@@ -13,4 +13,5 @@ export var Upload = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
13
13
|
}, props)) : /*#__PURE__*/React.createElement(ImageUpload, _extends({
|
14
14
|
ref: ref
|
15
15
|
}, props)));
|
16
|
-
});
|
16
|
+
});
|
17
|
+
export var Upload = UploadInternal;
|