@pointcloud/pcloud-components 0.1.16 → 0.1.18

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.
@@ -1,5 +1,5 @@
1
1
  import { HTMLAttributes, ReactNode } from 'react';
2
- import { InputProps, InputNumberProps, AutoCompleteProps, CascaderProps, SelectProps, TreeSelectProps, DatePickerProps, TimePickerProps, MentionProps, CheckboxProps, RadioProps, RateProps, SliderSingleProps, SwitchProps, TransferProps, UploadProps, ButtonProps, DividerProps, FormItemProps, RadioGroupProps } from 'antd';
2
+ import { InputProps, InputNumberProps, AutoCompleteProps, CascaderProps, SelectProps, TreeSelectProps, DatePickerProps, TimePickerProps, MentionProps, CheckboxProps, RadioProps, RateProps, SliderSingleProps, SwitchProps, TransferProps, UploadProps, ButtonProps, DividerProps, FormItemProps, RadioGroupProps, ColProps } from 'antd';
3
3
  import { PasswordProps, TextAreaProps } from 'antd/lib/input';
4
4
  import { RangePickerProps } from 'antd/lib/date-picker';
5
5
  import { CheckboxGroupProps } from 'antd/lib/checkbox';
@@ -14,7 +14,9 @@ export declare type DItemBaseProps = {
14
14
  /** name标签文本,同antd Form.Item的name */
15
15
  name?: string;
16
16
  /** Form.Item 的其他属性 */
17
- formItemProps?: FormItemProps;
17
+ formItemProps?: FormItemProps & {
18
+ grid?: Omit<ColProps, 'prefixCls'>;
19
+ };
18
20
  };
19
21
  /** 自定义渲染的DItem */
20
22
  declare type CustomItemProps = DItemBaseProps & HTMLAttributes<HTMLElement> & {
@@ -76,9 +78,15 @@ declare type MentionItemProps = {
76
78
  declare type CheckboxItemProps = {
77
79
  renderType?: 'checkbox';
78
80
  } & DItemBaseProps & CheckboxProps;
81
+ declare type DCheckboxGroupProps = {
82
+ renderType?: 'checkboxGroup';
83
+ } & DItemBaseProps & CheckboxGroupProps;
79
84
  declare type RadioItemProps = {
80
85
  renderType?: 'radio';
81
86
  } & DItemBaseProps & RadioProps;
87
+ declare type DRadioGorupProps = {
88
+ renderType?: 'radioGroup';
89
+ } & DItemBaseProps & RadioGroupProps;
82
90
  declare type RateItemProps = {
83
91
  renderType?: 'rate';
84
92
  } & DItemBaseProps & RateProps;
@@ -103,5 +111,5 @@ declare type ButtonItemProps = {
103
111
  declare type DividerItemProps = {
104
112
  renderType?: 'divider';
105
113
  } & DItemBaseProps & DividerProps;
106
- export declare type DItemProps = CustomItemProps | DInputItemProps | InputItemProps | TextAreaItemProps | PasswordItemProps | InputNumberItemProps | AutoCompleteItemProps | DSelectItemProps | SelectItemProps | DCascaderItemProps | CascaderItemProps | DTreeSelectItemProps | TreeSelectItemProps | DatePickerItemProps | TimePickerItemProps | RangePickerItemProps | MentionItemProps | CheckboxItemProps | CheckboxGroupProps | RadioItemProps | RadioGroupProps | RateItemProps | SliderItemProps | SwitchItemProps | TransferItemProps | UploadItemProps | DUploadItemProps | ButtonItemProps | DividerItemProps;
114
+ export declare type DItemProps = CustomItemProps | DInputItemProps | InputItemProps | TextAreaItemProps | PasswordItemProps | InputNumberItemProps | AutoCompleteItemProps | DSelectItemProps | SelectItemProps | DCascaderItemProps | CascaderItemProps | DTreeSelectItemProps | TreeSelectItemProps | DatePickerItemProps | TimePickerItemProps | RangePickerItemProps | MentionItemProps | CheckboxItemProps | CheckboxGroupProps | DCheckboxGroupProps | RadioItemProps | RadioGroupProps | DRadioGorupProps | RateItemProps | SliderItemProps | SwitchItemProps | TransferItemProps | UploadItemProps | DUploadItemProps | ButtonItemProps | DividerItemProps;
107
115
  export {};
@@ -33,7 +33,7 @@ declare const renderMap: {
33
33
  rate: (props: RateProps, formItemProps: FormItemProps) => JSX.Element;
34
34
  slider: (props: SliderSingleProps, formItemProps: FormItemProps) => JSX.Element;
35
35
  switch: (props: SwitchProps, formItemProps: FormItemProps) => JSX.Element;
36
- transfer: (props: TransferProps<any>, formItemProps: FormItemProps, render: TransferProps<any>['render']) => JSX.Element;
36
+ transfer: (props: TransferProps<any>, formItemProps: FormItemProps, label: DItemBaseProps['label'], render: TransferProps<any>['render']) => JSX.Element;
37
37
  upload: (props: UploadProps, formItemProps: FormItemProps, label: DItemBaseProps['label'], render: () => void, children: UploadProps['children']) => JSX.Element;
38
38
  dUpload: (props: DUploadProps, formItemProps: FormItemProps, render: (props: any) => ReactNode, children: DUploadProps['children']) => JSX.Element;
39
39
  button: (props: ButtonProps, formItemProps: FormItemProps, label: DItemBaseProps['label']) => JSX.Element;
@@ -165,7 +165,7 @@ var renderMap = {
165
165
  children: /*#__PURE__*/_jsx(Switch, _objectSpread({}, props))
166
166
  }));
167
167
  },
168
- transfer: function transfer(props, formItemProps, render) {
168
+ transfer: function transfer(props, formItemProps, label, render) {
169
169
  return /*#__PURE__*/_jsx(Form.Item, _objectSpread(_objectSpread({}, formItemProps), {}, {
170
170
  children: /*#__PURE__*/_jsx(Transfer, _objectSpread({
171
171
  render: render
@@ -9,8 +9,8 @@ declare type InternalFormProps = {
9
9
  defaultItemProps?: DItemProps;
10
10
  /** children 方式添加表单项,如果同时设置了 items,则 children 在 items 下面 */
11
11
  children?: ReactNode;
12
- /** 布局方式 新增了行内垂直布局方式inlineVertical */
13
- layout?: 'inline' | 'horizontal' | 'vertical' | 'inlineVertical';
12
+ /** 布局方式 新增了行内垂直布局方式inlineVertical 和 grid栅格布局 */
13
+ layout?: 'inline' | 'horizontal' | 'vertical' | 'inlineVertical' | 'grid';
14
14
  };
15
15
  declare type DFormProps = Omit<FormProps, 'children' | 'layout'> & InternalFormProps;
16
16
  declare type DFormRefProps = {
@@ -11,7 +11,7 @@ var _excluded = ["className", "defaultItemProps", "items", "children", "layout",
11
11
  */
12
12
 
13
13
  import React, { forwardRef, useContext, useState, useEffect, useImperativeHandle } from 'react';
14
- import { Form } from 'antd';
14
+ import { Form, Row, Col } from 'antd';
15
15
  import { ConfigContext } from "../ConfigProvider";
16
16
  import helper from "./helper";
17
17
  import DItem from "./DItem";
@@ -19,13 +19,26 @@ import "./index.less";
19
19
 
20
20
  // eslint-disable-next-line no-unused-vars
21
21
  import { jsx as _jsx } from "react/jsx-runtime";
22
- function getChildren(items, children, _defaultItemProps) {
22
+ function getChildren(items, children, _defaultItemProps, layout) {
23
23
  var list = [];
24
24
  if (items instanceof Array && items.length > 0) {
25
- list = items.map(function (item, index) {
26
- var _item = helper.merge(_defaultItemProps, item);
27
- return /*#__PURE__*/_jsx(DItem, _objectSpread({}, _item), (item === null || item === void 0 ? void 0 : item.name) || index);
28
- });
25
+ if (layout === 'grid') {
26
+ list.push( /*#__PURE__*/_jsx(Row, {
27
+ children: items.map(function (item, index) {
28
+ var _item$formItemProps;
29
+ var _item = helper.merge(_defaultItemProps, item);
30
+ var _gridProps = (_item === null || _item === void 0 ? void 0 : (_item$formItemProps = _item.formItemProps) === null || _item$formItemProps === void 0 ? void 0 : _item$formItemProps.grid) || {};
31
+ return /*#__PURE__*/_jsx(Col, _objectSpread(_objectSpread({}, _gridProps), {}, {
32
+ children: /*#__PURE__*/_jsx(DItem, _objectSpread({}, _item))
33
+ }), (item === null || item === void 0 ? void 0 : item.name) || index);
34
+ })
35
+ }));
36
+ } else {
37
+ list = items.map(function (item, index) {
38
+ var _item = helper.merge(_defaultItemProps, item);
39
+ return /*#__PURE__*/_jsx(DItem, _objectSpread({}, _item), (item === null || item === void 0 ? void 0 : item.name) || index);
40
+ });
41
+ }
29
42
  }
30
43
  if (children) {
31
44
  var childrenList = children instanceof Array ? children : [children];
@@ -44,34 +57,35 @@ function InternalForm(props, ref) {
44
57
  defaultItemProps = props.defaultItemProps,
45
58
  items = props.items,
46
59
  children = props.children,
47
- layout = props.layout,
60
+ _props$layout = props.layout,
61
+ layout = _props$layout === void 0 ? 'vertical' : _props$layout,
48
62
  _props$autoComplete = props.autoComplete,
49
63
  autoComplete = _props$autoComplete === void 0 ? 'off' : _props$autoComplete,
50
64
  otherProps = _objectWithoutProperties(props, _excluded);
51
65
  var _useContext = useContext(ConfigContext),
52
66
  getPrefixCls = _useContext.getPrefixCls;
53
- var _className = "".concat(getPrefixCls('form'), " ").concat(className, " ").concat(layout === 'inlineVertical' ? 'inlineVertical' : '');
54
- var _layout = layout === 'inlineVertical' ? 'inline' : layout;
55
- var _useState = useState(getChildren(items, children, defaultItemProps)),
67
+ var _className = "".concat(getPrefixCls('form'), " ").concat(className, " ").concat(['inlineVertical', 'grid'].includes(layout) ? 'inlineVertical' : '');
68
+ var _layout = ['inlineVertical', 'grid'].includes(layout) ? 'inline' : layout;
69
+ var _useState = useState(getChildren(items, children, defaultItemProps, layout)),
56
70
  _useState2 = _slicedToArray(_useState, 2),
57
71
  itemChildren = _useState2[0],
58
72
  setItemChildren = _useState2[1];
59
73
  useEffect(function () {
60
- setItemChildren(getChildren(items, children, defaultItemProps));
61
- }, [items, children, defaultItemProps]);
74
+ setItemChildren(getChildren(items, children, defaultItemProps, layout));
75
+ }, [items, children, defaultItemProps, layout]);
62
76
  useImperativeHandle(ref, function () {
63
77
  return {
64
78
  setItems: function setItems(value) {
65
79
  if (value instanceof Array) {
66
- setItemChildren(getChildren(value, null, defaultItemProps));
80
+ setItemChildren(getChildren(value, null, defaultItemProps, layout));
67
81
  } else if (typeof value === 'function') {
68
82
  var result = value(items || []);
69
83
  if ('then' in result) {
70
84
  result.then(function (list) {
71
- setItemChildren(getChildren(list, null, defaultItemProps));
85
+ setItemChildren(getChildren(list, null, defaultItemProps, layout));
72
86
  });
73
87
  } else {
74
- setItemChildren(getChildren(result, null, defaultItemProps));
88
+ setItemChildren(getChildren(result, null, defaultItemProps, layout));
75
89
  }
76
90
  }
77
91
  }
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import { DModalProps, DeleteModalProps } from './interface';
3
+ import './styles/index.less';
4
+ declare function DModal(props: DModalProps): JSX.Element;
5
+ declare namespace DModal {
6
+ export var useModal: typeof import("antd/lib/modal/useModal").default;
7
+ export var info: import("antd/lib/modal/confirm").ModalFunc;
8
+ export var success: import("antd/lib/modal/confirm").ModalFunc;
9
+ export var error: import("antd/lib/modal/confirm").ModalFunc;
10
+ export var warning: import("antd/lib/modal/confirm").ModalFunc;
11
+ export var confirm: import("antd/lib/modal/confirm").ModalFunc;
12
+ var _a: ({ content, onOk, onCancel, zIndex }: DeleteModalProps) => {
13
+ destroy: () => void;
14
+ update: (configUpdate: import("antd").ModalFuncProps | ((prevConfig: import("antd").ModalFuncProps) => import("antd").ModalFuncProps)) => void;
15
+ };
16
+ export { _a as delete };
17
+ }
18
+ export default DModal;
@@ -3,10 +3,10 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
3
3
  var _excluded = ["children", "mode"];
4
4
  import { ConfigContext } from "../ConfigProvider";
5
5
  import { Modal } from 'antd';
6
- import React, { useContext, useEffect, useMemo, useRef } from 'react';
6
+ import { useContext, useEffect, useMemo, useRef } from 'react';
7
7
  import "./styles/index.less";
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
- function LModal(props) {
9
+ function DModal(props) {
10
10
  var children = props.children,
11
11
  _props$mode = props.mode,
12
12
  mode = _props$mode === void 0 ? 'absolute' : _props$mode,
@@ -19,7 +19,8 @@ function LModal(props) {
19
19
  return _objectSpread({
20
20
  getContainer: containerRef.current,
21
21
  width: ((_otherProps$style = otherProps.style) === null || _otherProps$style === void 0 ? void 0 : _otherProps$style.width) || '80%',
22
- centered: true
22
+ centered: true,
23
+ maskClosable: false
23
24
  }, otherProps);
24
25
  }, [otherProps]);
25
26
  useEffect(function () {
@@ -49,4 +50,28 @@ function LModal(props) {
49
50
  }))
50
51
  });
51
52
  }
52
- export default LModal;
53
+ DModal.useModal = Modal.useModal;
54
+ DModal.info = Modal.info;
55
+ DModal.success = Modal.success;
56
+ DModal.error = Modal.error;
57
+ DModal.warning = Modal.warning;
58
+ DModal.confirm = Modal.confirm;
59
+ DModal.delete = function (_ref) {
60
+ var content = _ref.content,
61
+ onOk = _ref.onOk,
62
+ onCancel = _ref.onCancel,
63
+ zIndex = _ref.zIndex;
64
+ return DModal.confirm({
65
+ title: '删除提示',
66
+ content: content,
67
+ centered: true,
68
+ closable: true,
69
+ okText: '确定',
70
+ cancelText: '取消',
71
+ className: 'pui-modal-container',
72
+ onOk: onOk,
73
+ onCancel: onCancel,
74
+ zIndex: zIndex
75
+ });
76
+ };
77
+ export default DModal;
@@ -1,8 +1,14 @@
1
- import { ModalProps } from 'antd';
2
1
  import { ReactNode } from 'react';
2
+ import { ModalProps } from 'antd';
3
3
  declare type IModalProps = Omit<ModalProps, 'width' | 'className'>;
4
- export interface LModalProps extends IModalProps {
4
+ export interface DModalProps extends IModalProps {
5
5
  children?: ReactNode | undefined;
6
6
  mode?: 'absolute' | 'relative' | 'panel';
7
7
  }
8
+ export interface DeleteModalProps {
9
+ content?: React.ReactNode;
10
+ onOk?: (...args: any[]) => any;
11
+ onCancel?: (...args: any[]) => any;
12
+ zIndex?: number;
13
+ }
8
14
  export {};
@@ -1,27 +1,27 @@
1
- @import '../../commonStyle/index.less';
2
-
3
- .@{prefix}-modal-container {
4
- .ant-modal-wrap {
5
- .ant-modal {
6
- max-width: unset;
7
- height: 100%;
8
-
9
- .ant-modal-content {
10
- width: 100%;
11
- height: 100%;
12
- }
13
- }
14
- }
15
- }
16
-
17
- .@{prefix}-absolute-modal-container {
18
- .ant-modal-wrap {
19
- position: fixed;
20
- }
21
- }
22
-
23
- .@{prefix}-relative-modal-container {
24
- .ant-modal-wrap {
25
- position: absolute;
26
- }
27
- }
1
+ @import '../../commonStyle/index.less';
2
+
3
+ .@{prefix}-modal-container {
4
+ .ant-modal-wrap {
5
+ .ant-modal {
6
+ max-width: unset;
7
+ height: 100%;
8
+
9
+ .ant-modal-content {
10
+ width: 100%;
11
+ height: 100%;
12
+ }
13
+ }
14
+ }
15
+ }
16
+
17
+ .@{prefix}-absolute-modal-container {
18
+ .ant-modal-wrap {
19
+ position: fixed;
20
+ }
21
+ }
22
+
23
+ .@{prefix}-relative-modal-container {
24
+ .ant-modal-wrap {
25
+ position: absolute;
26
+ }
27
+ }
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import { LabelValueProps } from './interface';
2
+ import { LabelValueProps as ILabelValueProps } from './interface';
3
3
  import './styles/index.less';
4
- declare function LabelValue({ label, value, emptyValue, className, noWrap, noColon }: LabelValueProps): JSX.Element;
4
+ export declare type LabelValueProps = ILabelValueProps;
5
+ declare function LabelValue({ label, value, emptyValue, className, noWrap, noColon }: ILabelValueProps): JSX.Element;
5
6
  declare namespace LabelValue {
6
7
  var defaultProps: {
7
8
  className: string;
@@ -6,7 +6,7 @@ export interface LabelValueProps {
6
6
  /**
7
7
  * @description 文字标签值
8
8
  */
9
- value?: string | undefined | null;
9
+ value?: string | undefined;
10
10
  /**
11
11
  * @description 文字标签值为空时的值
12
12
  * @default -
@@ -1,4 +1,5 @@
1
1
  export { default as LabelValue } from './LabelValue';
2
+ export type { LabelValueProps } from './LabelValue';
2
3
  export { default as AdvancedFilter } from './AdvancedFilter';
3
4
  export { default as AuthComponent } from './AuthComponent';
4
5
  export type { FProps } from './AdvancedFilter/interface';
@@ -20,8 +21,8 @@ export type { DColumnType, DTableProps, DTableSourceProps, TableParamsProps } fr
20
21
  export { default as DTable } from './DTable';
21
22
  export type { DFormProps, DFormRefProps, DItemProps } from './DForm';
22
23
  export { default as DForm } from './DForm';
23
- export type { LModalProps } from './LModal/interface';
24
- export { default as LModal } from './LModal';
24
+ export type { DModalProps } from './DModal/interface';
25
+ export { default as DModal } from './DModal';
25
26
  export { default as ColorPicker } from './ColorPicker';
26
27
  export type { ColorPickerType, TwitterPickerType, HuePickerType, AlphaPickerType, BlockPickerType, ChromePickerType, CompactPickerType, CirclePickerType, SliderPickerType, } from './ColorPicker/interface';
27
28
  export { default as ScrollNumber } from './ScrollNumber';
package/dist/esm/index.js CHANGED
@@ -12,6 +12,6 @@ export { default as DTreeSelect } from "./DTreeSelect";
12
12
  export { default as DUpload } from "./DUpload";
13
13
  export { default as DTable } from "./DTable";
14
14
  export { default as DForm } from "./DForm";
15
- export { default as LModal } from "./LModal";
15
+ export { default as DModal } from "./DModal";
16
16
  export { default as ColorPicker } from "./ColorPicker";
17
17
  export { default as ScrollNumber } from "./ScrollNumber";