@fairys/taro-tools-simple-form 0.0.2 → 0.0.3
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/esm/components/calendar/index.d.ts +10 -0
- package/esm/components/calendar/index.js +35 -0
- package/esm/components/cascader/index.d.ts +10 -0
- package/esm/components/cascader/index.js +85 -0
- package/esm/components/checkbox.group/index.d.ts +5 -0
- package/esm/components/checkbox.group/index.js +14 -0
- package/esm/components/clear/index.d.ts +21 -0
- package/esm/components/clear/index.js +31 -0
- package/esm/components/date.picker/index.d.ts +18 -0
- package/esm/components/date.picker/index.js +122 -0
- package/esm/components/index.d.ts +8 -0
- package/esm/components/index.js +8 -0
- package/esm/components/picker/index.d.ts +9 -0
- package/esm/components/picker/index.js +45 -0
- package/esm/components/popup.search/base.d.ts +2 -0
- package/esm/components/popup.search/base.js +70 -0
- package/esm/components/popup.search/index.d.ts +9 -0
- package/esm/components/popup.search/index.js +157 -0
- package/esm/components/popup.search/instance.d.ts +169 -0
- package/esm/components/popup.search/instance.js +319 -0
- package/esm/components/popup.search/list.table.d.ts +1 -0
- package/esm/components/popup.search/list.table.js +89 -0
- package/esm/components/popup.search/list.virtual.d.ts +1 -0
- package/esm/components/popup.search/list.virtual.js +60 -0
- package/esm/components/radio.group/index.d.ts +5 -0
- package/esm/components/radio.group/index.js +13 -0
- package/esm/index.d.ts +17 -0
- package/esm/index.js +15 -0
- package/esm/interface.d.ts +3 -0
- package/esm/interface.js +0 -0
- package/esm/item.config.d.ts +57 -0
- package/esm/item.config.js +125 -0
- package/esm/styles/index.css +167 -0
- package/lib/index.js +91 -0
- package/package.json +2 -2
- package/src/components/calendar/index.tsx +10 -11
- package/src/components/cascader/index.tsx +9 -11
- package/src/components/clear/index.tsx +49 -0
- package/src/components/date.picker/index.tsx +11 -11
- package/src/components/index.ts +8 -0
- package/src/components/picker/index.tsx +9 -11
- package/src/components/popup.search/index.tsx +86 -64
- package/src/components/popup.search/instance.ts +40 -9
- package/src/components/popup.search/list.table.tsx +3 -2
- package/src/components/popup.search/list.virtual.tsx +3 -2
- package/src/index.tsx +4 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Checkbox, Table } from "@nutui/nutui-react-taro";
|
|
3
|
+
import { Del } from "@nutui/icons-react-taro";
|
|
4
|
+
import { useFairysTaroPopupSearchBaseInstanceContext } from "./instance.js";
|
|
5
|
+
import { useMemo } from "react";
|
|
6
|
+
function TableItemCheckBox(props) {
|
|
7
|
+
const { rowData } = props;
|
|
8
|
+
const [state, instance] = useFairysTaroPopupSearchBaseInstanceContext();
|
|
9
|
+
const _tempValue = state._tempValue;
|
|
10
|
+
const operationStatus = state.operationStatus;
|
|
11
|
+
const manageSelectedDataList = state.manageSelectedDataList;
|
|
12
|
+
const checked = useMemo(()=>instance.isCheckedData(rowData), [
|
|
13
|
+
rowData,
|
|
14
|
+
_tempValue,
|
|
15
|
+
operationStatus,
|
|
16
|
+
manageSelectedDataList
|
|
17
|
+
]);
|
|
18
|
+
return /*#__PURE__*/ jsx(Checkbox, {
|
|
19
|
+
className: "fairys-taro-popup-search-list-virtual-checkbox fairystaroform__flex-1",
|
|
20
|
+
checked: checked,
|
|
21
|
+
onChange: ()=>instance.onCheckedData(rowData, checked)
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
function TableItemDelete(props) {
|
|
25
|
+
const { rowData } = props;
|
|
26
|
+
const [, instance] = useFairysTaroPopupSearchBaseInstanceContext();
|
|
27
|
+
return /*#__PURE__*/ jsx(Button, {
|
|
28
|
+
size: "mini",
|
|
29
|
+
fill: "none",
|
|
30
|
+
className: "fairys-taro-popup-search-list-virtual-delete-button",
|
|
31
|
+
onClick: ()=>instance.onDeleteData(rowData),
|
|
32
|
+
icon: /*#__PURE__*/ jsx(Del, {
|
|
33
|
+
color: "red"
|
|
34
|
+
})
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function FairysTaroPopupSearchListTable() {
|
|
38
|
+
const [state, instance] = useFairysTaroPopupSearchBaseInstanceContext();
|
|
39
|
+
const popupHeight = instance.popupHeight;
|
|
40
|
+
const data = state._tempFilterDataList || [];
|
|
41
|
+
const operationStatus = state.operationStatus;
|
|
42
|
+
const columns = state.columns || [];
|
|
43
|
+
const tableProps = instance.useTableProps?.(instance.tableProps || {}, instance) || instance.tableProps || {};
|
|
44
|
+
const showRowDeleteButton = instance.showRowDeleteButton;
|
|
45
|
+
const _newColumns = useMemo(()=>{
|
|
46
|
+
const list = [
|
|
47
|
+
{
|
|
48
|
+
key: '__checkbox',
|
|
49
|
+
width: 16,
|
|
50
|
+
align: 'center',
|
|
51
|
+
title: '',
|
|
52
|
+
render: (rowData)=>/*#__PURE__*/ jsx(TableItemCheckBox, {
|
|
53
|
+
rowData: rowData
|
|
54
|
+
})
|
|
55
|
+
}
|
|
56
|
+
].concat([
|
|
57
|
+
...columns
|
|
58
|
+
]);
|
|
59
|
+
if ('manage' === operationStatus && 'multiple' === instance.mode && showRowDeleteButton) return [
|
|
60
|
+
...list,
|
|
61
|
+
{
|
|
62
|
+
key: '__delete',
|
|
63
|
+
width: 16,
|
|
64
|
+
align: 'center',
|
|
65
|
+
title: '',
|
|
66
|
+
render: (rowData)=>/*#__PURE__*/ jsx(TableItemDelete, {
|
|
67
|
+
rowData: rowData
|
|
68
|
+
})
|
|
69
|
+
}
|
|
70
|
+
];
|
|
71
|
+
return list;
|
|
72
|
+
}, [
|
|
73
|
+
columns,
|
|
74
|
+
operationStatus,
|
|
75
|
+
showRowDeleteButton
|
|
76
|
+
]);
|
|
77
|
+
return /*#__PURE__*/ jsx(Table, {
|
|
78
|
+
bordered: true,
|
|
79
|
+
...tableProps,
|
|
80
|
+
className: `fairys-taro-popup-search-list-table ${tableProps?.className || ''}`,
|
|
81
|
+
style: {
|
|
82
|
+
height: popupHeight,
|
|
83
|
+
...tableProps?.style || {}
|
|
84
|
+
},
|
|
85
|
+
columns: _newColumns,
|
|
86
|
+
data: data
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
export { FairysTaroPopupSearchListTable };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function FairysTaroPopupSearchListVirtual<T = any>(): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Cell, Checkbox, VirtualList } from "@nutui/nutui-react-taro";
|
|
3
|
+
import { Del } from "@nutui/icons-react-taro";
|
|
4
|
+
import { useFairysTaroPopupSearchBaseInstanceContext } from "./instance.js";
|
|
5
|
+
import { Fragment, useMemo } from "react";
|
|
6
|
+
function VirtualListItem(props) {
|
|
7
|
+
const { rowData } = props;
|
|
8
|
+
const [state, instance] = useFairysTaroPopupSearchBaseInstanceContext();
|
|
9
|
+
const renderListItemText = instance.renderListItemText;
|
|
10
|
+
const _tempValue = state._tempValue;
|
|
11
|
+
const operationStatus = state.operationStatus;
|
|
12
|
+
const manageSelectedDataList = state.manageSelectedDataList;
|
|
13
|
+
const showRowDeleteButton = instance.showRowDeleteButton;
|
|
14
|
+
const renderText = useMemo(()=>renderListItemText?.(rowData, instance) || rowData[instance.displayField], [
|
|
15
|
+
rowData,
|
|
16
|
+
instance.displayField,
|
|
17
|
+
renderListItemText
|
|
18
|
+
]);
|
|
19
|
+
const checked = useMemo(()=>instance.isCheckedData(rowData), [
|
|
20
|
+
rowData,
|
|
21
|
+
_tempValue,
|
|
22
|
+
operationStatus,
|
|
23
|
+
manageSelectedDataList
|
|
24
|
+
]);
|
|
25
|
+
return /*#__PURE__*/ jsx(Cell, {
|
|
26
|
+
className: "fairys-taro-popup-search-list-virtual-cell",
|
|
27
|
+
title: /*#__PURE__*/ jsx(Checkbox, {
|
|
28
|
+
className: "fairys-taro-popup-search-list-virtual-checkbox fairystaroform__flex-1",
|
|
29
|
+
checked: checked,
|
|
30
|
+
onChange: ()=>instance.onCheckedData(rowData, checked),
|
|
31
|
+
children: renderText
|
|
32
|
+
}),
|
|
33
|
+
extra: 'manage' === operationStatus && showRowDeleteButton ? /*#__PURE__*/ jsx(Button, {
|
|
34
|
+
size: "mini",
|
|
35
|
+
fill: "none",
|
|
36
|
+
className: "fairys-taro-popup-search-list-virtual-delete-button",
|
|
37
|
+
onClick: ()=>instance.onDeleteData(rowData),
|
|
38
|
+
icon: /*#__PURE__*/ jsx(Del, {
|
|
39
|
+
color: "red"
|
|
40
|
+
})
|
|
41
|
+
}) : /*#__PURE__*/ jsx(Fragment, {})
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
function FairysTaroPopupSearchListVirtual() {
|
|
45
|
+
const [state, instance] = useFairysTaroPopupSearchBaseInstanceContext();
|
|
46
|
+
const popupHeight = instance.popupHeight;
|
|
47
|
+
const _tempFilterDataList = state._tempFilterDataList;
|
|
48
|
+
return /*#__PURE__*/ jsx(VirtualList, {
|
|
49
|
+
containerHeight: popupHeight,
|
|
50
|
+
itemHeight: 46,
|
|
51
|
+
list: _tempFilterDataList,
|
|
52
|
+
itemRender: (item, dataIndex, index)=>/*#__PURE__*/ jsx(VirtualListItem, {
|
|
53
|
+
rowData: item,
|
|
54
|
+
dataIndex: dataIndex,
|
|
55
|
+
index: index
|
|
56
|
+
}),
|
|
57
|
+
itemEqual: false
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
export { FairysTaroPopupSearchListVirtual };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RadioGroupProps, RadioProps } from '@nutui/nutui-react-taro';
|
|
2
|
+
export interface FairysTaroRadioGroupProps extends Partial<RadioGroupProps> {
|
|
3
|
+
items?: RadioProps[];
|
|
4
|
+
}
|
|
5
|
+
export declare const FairysTaroRadioGroupBase: (props: FairysTaroRadioGroupProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Radio, RadioGroup } from "@nutui/nutui-react-taro";
|
|
3
|
+
const FairysTaroRadioGroupBase = (props)=>{
|
|
4
|
+
const { items, className, ...rest } = props;
|
|
5
|
+
return /*#__PURE__*/ jsx(RadioGroup, {
|
|
6
|
+
className: `fairys-taro-radio-group ${className || ''}`,
|
|
7
|
+
...rest,
|
|
8
|
+
children: items?.map((item)=>/*#__PURE__*/ jsx(Radio, {
|
|
9
|
+
...item
|
|
10
|
+
}, item.value))
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
export { FairysTaroRadioGroupBase };
|
package/esm/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 简版表单
|
|
3
|
+
* 用于快速创建表单,支持文本输入、选择框、单选框、复选框等常用表单元素。
|
|
4
|
+
* */
|
|
5
|
+
import { useForm } from '@carefrees/form-utils-react-taro';
|
|
6
|
+
import { FairysTaroSimpleFormProps } from './interface';
|
|
7
|
+
import { InputConfigType } from './item.config';
|
|
8
|
+
export * from './components';
|
|
9
|
+
export declare const FairysTaroSimpleForm: {
|
|
10
|
+
(props: FairysTaroSimpleFormProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
Item: (config: InputConfigType) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
ListItem: (props: {
|
|
13
|
+
items: InputConfigType[];
|
|
14
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
useForm: typeof useForm;
|
|
16
|
+
useWatch: (name: string, form?: import("@carefrees/form-utils").FormInstanceBase, callBack?: (value: any, form: import("@carefrees/form-utils").FormInstanceBase) => void) => [any, import("@carefrees/form-utils").FormInstanceBase, import("@carefrees/form-utils-react-taro").WatchInstanceBase];
|
|
17
|
+
};
|
package/esm/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Form, useForm, useWatch } from "@carefrees/form-utils-react-taro";
|
|
3
|
+
import { ConfigItem, ConfigListItem } from "./item.config.js";
|
|
4
|
+
export * from "./components/index.js";
|
|
5
|
+
const FairysTaroSimpleForm = (props)=>/*#__PURE__*/ jsx(Form, {
|
|
6
|
+
labelMode: "between",
|
|
7
|
+
colCount: 1,
|
|
8
|
+
inputBordered: false,
|
|
9
|
+
...props
|
|
10
|
+
});
|
|
11
|
+
FairysTaroSimpleForm.Item = ConfigItem;
|
|
12
|
+
FairysTaroSimpleForm.ListItem = ConfigListItem;
|
|
13
|
+
FairysTaroSimpleForm.useForm = useForm;
|
|
14
|
+
FairysTaroSimpleForm.useWatch = useWatch;
|
|
15
|
+
export { FairysTaroSimpleForm };
|
package/esm/interface.js
ADDED
|
File without changes
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import type { FormItemProps, FormListProps } from '@carefrees/form-utils-react-taro';
|
|
3
|
+
import { FairysTaroRadioGroupProps } from './components/radio.group';
|
|
4
|
+
import { FairysTaroCalendarProps } from './components/calendar';
|
|
5
|
+
import { FairysTaroCascaderProps } from './components/cascader';
|
|
6
|
+
import { FairysTaroCheckboxGroupProps } from './components/checkbox.group';
|
|
7
|
+
import { FairysTaroDatePickerProps } from './components/date.picker';
|
|
8
|
+
import { FairysTaroPickerProps } from './components/picker';
|
|
9
|
+
import { FairysTaroPopupSearchProps } from './components/popup.search';
|
|
10
|
+
import { TaroInputProps, TaroInputNumberProps, RadioGroupProps, RadioProps, RangeProps, RateProps, SignatureProps, SwitchProps, TextAreaProps, UploaderProps } from '@nutui/nutui-react-taro';
|
|
11
|
+
export interface ItemType<T, K = TaroInputProps> extends FormItemProps {
|
|
12
|
+
/**输入框类型*/
|
|
13
|
+
type?: T;
|
|
14
|
+
/**输入框属性*/
|
|
15
|
+
attr?: K;
|
|
16
|
+
/**自定义渲染函数*/
|
|
17
|
+
render?: undefined;
|
|
18
|
+
/**是否添加隐藏组件*/
|
|
19
|
+
isHide?: boolean;
|
|
20
|
+
/**是否添加置空组件*/
|
|
21
|
+
isEmpty?: boolean;
|
|
22
|
+
}
|
|
23
|
+
type CustomType = {
|
|
24
|
+
isEmpty?: boolean;
|
|
25
|
+
type?: 'custom';
|
|
26
|
+
render?: any;
|
|
27
|
+
isHide?: boolean;
|
|
28
|
+
attr?: any;
|
|
29
|
+
label?: ReactNode | {
|
|
30
|
+
text?: string;
|
|
31
|
+
};
|
|
32
|
+
} & FormItemProps;
|
|
33
|
+
type CustomRenderType = {
|
|
34
|
+
isEmpty?: boolean;
|
|
35
|
+
type?: 'render';
|
|
36
|
+
render?: React.ReactNode;
|
|
37
|
+
isHide?: boolean;
|
|
38
|
+
attr?: any;
|
|
39
|
+
label?: ReactNode | {
|
|
40
|
+
text?: string;
|
|
41
|
+
};
|
|
42
|
+
} & FormItemProps;
|
|
43
|
+
type CustomFormListType = {
|
|
44
|
+
isEmpty?: boolean;
|
|
45
|
+
type?: 'formList';
|
|
46
|
+
isHide?: boolean;
|
|
47
|
+
attr?: any;
|
|
48
|
+
label?: ReactNode | {
|
|
49
|
+
text?: string;
|
|
50
|
+
};
|
|
51
|
+
} & FormListProps;
|
|
52
|
+
export type InputConfigType = ItemType<'input', TaroInputProps> | ItemType<'inputNumber', TaroInputNumberProps> | ItemType<'fairysRadioGroup', FairysTaroRadioGroupProps> | ItemType<'fairysCalendar', FairysTaroCalendarProps> | ItemType<'fairysCascader', FairysTaroCascaderProps> | ItemType<'fairysCheckboxGroup', FairysTaroCheckboxGroupProps> | ItemType<'fairysDatePicker', FairysTaroDatePickerProps> | ItemType<'fairysPicker', FairysTaroPickerProps> | ItemType<'fairysPopupSearch', FairysTaroPopupSearchProps> | ItemType<'radioGroup', RadioGroupProps> | ItemType<'radio', RadioProps> | ItemType<'range', RangeProps> | ItemType<'rate', RateProps> | ItemType<'signature', SignatureProps> | ItemType<'switch', SwitchProps> | ItemType<'textarea', TextAreaProps> | ItemType<'uploader', UploaderProps> | CustomType | CustomRenderType | CustomFormListType;
|
|
53
|
+
export declare const ConfigListItem: (props: {
|
|
54
|
+
items: InputConfigType[];
|
|
55
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
56
|
+
export declare const ConfigItem: (config: InputConfigType) => import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { View } from "@tarojs/components";
|
|
3
|
+
import { Fragment } from "react";
|
|
4
|
+
import { FormHideItem, FormHideList, FormItem, FormList } from "@carefrees/form-utils-react-taro";
|
|
5
|
+
import { FairysTaroRadioGroupBase } from "./components/radio.group/index.js";
|
|
6
|
+
import { FairysTaroCalendarBase } from "./components/calendar/index.js";
|
|
7
|
+
import { FairysTaroCascaderBase } from "./components/cascader/index.js";
|
|
8
|
+
import { FairysTaroCheckboxGroupBase } from "./components/checkbox.group/index.js";
|
|
9
|
+
import { FairysTaroDatePickerBase } from "./components/date.picker/index.js";
|
|
10
|
+
import { FairysTaroPickerBase } from "./components/picker/index.js";
|
|
11
|
+
import { FairysTaroPopupSearchBase } from "./components/popup.search/index.js";
|
|
12
|
+
import { Input, InputNumber, Radio, RadioGroup, Range, Rate, Signature, Switch, TextArea, Uploader } from "@nutui/nutui-react-taro";
|
|
13
|
+
const create_itemConfig = (configList)=>/*#__PURE__*/ jsx(Fragment, {
|
|
14
|
+
children: configList.map((item, index)=>{
|
|
15
|
+
const { type, isHide, attr = {}, isEmpty, ...rest } = item;
|
|
16
|
+
const newItem = {
|
|
17
|
+
attr,
|
|
18
|
+
...rest
|
|
19
|
+
};
|
|
20
|
+
if ('custom' === type) newItem.children = item.render || /*#__PURE__*/ jsx(Fragment, {});
|
|
21
|
+
else if ('render' === type) return /*#__PURE__*/ jsx(Fragment, {
|
|
22
|
+
children: item.render
|
|
23
|
+
}, index);
|
|
24
|
+
else if ('formList' === type) {
|
|
25
|
+
if ('function' == typeof item.children) {
|
|
26
|
+
if (isHide) return /*#__PURE__*/ jsx(FormHideList, {
|
|
27
|
+
sort: `${index}`,
|
|
28
|
+
...rest,
|
|
29
|
+
children: item.children,
|
|
30
|
+
name: item.name
|
|
31
|
+
}, index);
|
|
32
|
+
return /*#__PURE__*/ jsx(FormList, {
|
|
33
|
+
sort: `${index}`,
|
|
34
|
+
...rest,
|
|
35
|
+
children: item.children,
|
|
36
|
+
name: item.name
|
|
37
|
+
}, index);
|
|
38
|
+
}
|
|
39
|
+
return /*#__PURE__*/ jsx(Fragment, {}, index);
|
|
40
|
+
} else if ('input' === type) newItem.children = /*#__PURE__*/ jsx(Input, {
|
|
41
|
+
align: "right",
|
|
42
|
+
clearable: true,
|
|
43
|
+
...attr
|
|
44
|
+
});
|
|
45
|
+
else if ('inputNumber' === type) newItem.children = /*#__PURE__*/ jsx(InputNumber, {
|
|
46
|
+
align: "right",
|
|
47
|
+
clearable: true,
|
|
48
|
+
...attr
|
|
49
|
+
});
|
|
50
|
+
else if ('fairysRadioGroup' === type) newItem.children = /*#__PURE__*/ jsx(FairysTaroRadioGroupBase, {
|
|
51
|
+
...attr
|
|
52
|
+
});
|
|
53
|
+
else if ('radioGroup' === type) newItem.children = /*#__PURE__*/ jsx(RadioGroup, {
|
|
54
|
+
...attr
|
|
55
|
+
});
|
|
56
|
+
else if ('radio' === type) newItem.children = /*#__PURE__*/ jsx(Radio, {
|
|
57
|
+
...attr
|
|
58
|
+
});
|
|
59
|
+
else if ('range' === type) newItem.children = /*#__PURE__*/ jsx(Range, {
|
|
60
|
+
...attr
|
|
61
|
+
});
|
|
62
|
+
else if ('rate' === type) newItem.children = /*#__PURE__*/ jsx(Rate, {
|
|
63
|
+
...attr
|
|
64
|
+
});
|
|
65
|
+
else if ('signature' === type) newItem.children = /*#__PURE__*/ jsx(Signature, {
|
|
66
|
+
...attr
|
|
67
|
+
});
|
|
68
|
+
else if ('switch' === type) newItem.children = /*#__PURE__*/ jsx(Switch, {
|
|
69
|
+
...attr
|
|
70
|
+
});
|
|
71
|
+
else if ('textarea' === type) newItem.children = /*#__PURE__*/ jsx(TextArea, {
|
|
72
|
+
...attr
|
|
73
|
+
});
|
|
74
|
+
else if ('uploader' === type) newItem.children = /*#__PURE__*/ jsx(Uploader, {
|
|
75
|
+
...attr
|
|
76
|
+
});
|
|
77
|
+
else if ('fairysCalendar' === type) newItem.children = /*#__PURE__*/ jsx(FairysTaroCalendarBase, {
|
|
78
|
+
...attr
|
|
79
|
+
});
|
|
80
|
+
else if ('fairysCascader' === type) {
|
|
81
|
+
const title = attr.title || ('string' == typeof item.label ? item.label : '') || "\u8BF7\u9009\u62E9";
|
|
82
|
+
newItem.children = /*#__PURE__*/ jsx(FairysTaroCascaderBase, {
|
|
83
|
+
...attr,
|
|
84
|
+
title: title
|
|
85
|
+
});
|
|
86
|
+
} else if ('fairysCheckboxGroup' === type) newItem.children = /*#__PURE__*/ jsx(FairysTaroCheckboxGroupBase, {
|
|
87
|
+
...attr
|
|
88
|
+
});
|
|
89
|
+
else if ('fairysDatePicker' === type) {
|
|
90
|
+
const title = attr.title || ('string' == typeof item.label ? item.label : '') || "\u8BF7\u9009\u62E9";
|
|
91
|
+
newItem.children = /*#__PURE__*/ jsx(FairysTaroDatePickerBase, {
|
|
92
|
+
...attr,
|
|
93
|
+
title: title
|
|
94
|
+
});
|
|
95
|
+
} else if ('fairysPicker' === type) {
|
|
96
|
+
const title = attr.title || ('string' == typeof item.label ? item.label : '') || "\u8BF7\u9009\u62E9";
|
|
97
|
+
newItem.children = /*#__PURE__*/ jsx(FairysTaroPickerBase, {
|
|
98
|
+
...attr,
|
|
99
|
+
title: title
|
|
100
|
+
});
|
|
101
|
+
} else if ('fairysPopupSearch' === type) {
|
|
102
|
+
const title = attr.title || ('string' == typeof item.label ? item.label : '') || "\u8BF7\u9009\u62E9";
|
|
103
|
+
newItem.children = /*#__PURE__*/ jsx(FairysTaroPopupSearchBase, {
|
|
104
|
+
...attr,
|
|
105
|
+
title: title
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
if (isEmpty) return /*#__PURE__*/ jsx(View, {
|
|
109
|
+
className: "fairys-taro-simple-form-item-empty"
|
|
110
|
+
}, index);
|
|
111
|
+
if (isHide) return /*#__PURE__*/ jsx(FormHideItem, {
|
|
112
|
+
sort: `${index}`,
|
|
113
|
+
...newItem
|
|
114
|
+
}, index);
|
|
115
|
+
return /*#__PURE__*/ jsx(FormItem, {
|
|
116
|
+
sort: `${index}`,
|
|
117
|
+
...newItem
|
|
118
|
+
}, index);
|
|
119
|
+
})
|
|
120
|
+
});
|
|
121
|
+
const ConfigListItem = (props)=>create_itemConfig(props.items);
|
|
122
|
+
const ConfigItem = (config)=>create_itemConfig([
|
|
123
|
+
config
|
|
124
|
+
]);
|
|
125
|
+
export { ConfigItem, ConfigListItem };
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
@import "@carefrees/form-utils-react-taro/assets/index.css";
|
|
2
|
+
|
|
3
|
+
*, :before, :after, ::backdrop {
|
|
4
|
+
--un-rotate: 0;
|
|
5
|
+
--un-rotate-x: 0;
|
|
6
|
+
--un-rotate-y: 0;
|
|
7
|
+
--un-rotate-z: 0;
|
|
8
|
+
--un-scale-x: 1;
|
|
9
|
+
--un-scale-y: 1;
|
|
10
|
+
--un-scale-z: 1;
|
|
11
|
+
--un-skew-x: 0;
|
|
12
|
+
--un-skew-y: 0;
|
|
13
|
+
--un-translate-x: 0;
|
|
14
|
+
--un-translate-y: 0;
|
|
15
|
+
--un-translate-z: 0;
|
|
16
|
+
--un-pan-x: ;
|
|
17
|
+
--un-pan-y: ;
|
|
18
|
+
--un-pinch-zoom: ;
|
|
19
|
+
--un-scroll-snap-strictness: proximity;
|
|
20
|
+
--un-ordinal: ;
|
|
21
|
+
--un-slashed-zero: ;
|
|
22
|
+
--un-numeric-figure: ;
|
|
23
|
+
--un-numeric-spacing: ;
|
|
24
|
+
--un-numeric-fraction: ;
|
|
25
|
+
--un-border-spacing-x: 0;
|
|
26
|
+
--un-border-spacing-y: 0;
|
|
27
|
+
--un-ring-offset-shadow: 0 0 #0000;
|
|
28
|
+
--un-ring-shadow: 0 0 #0000;
|
|
29
|
+
--un-shadow-inset: ;
|
|
30
|
+
--un-shadow: 0 0 #0000;
|
|
31
|
+
--un-ring-inset: ;
|
|
32
|
+
--un-ring-offset-width: 0px;
|
|
33
|
+
--un-ring-offset-color: #fff;
|
|
34
|
+
--un-ring-width: 0px;
|
|
35
|
+
--un-ring-color: #93c5fd80;
|
|
36
|
+
--un-blur: ;
|
|
37
|
+
--un-brightness: ;
|
|
38
|
+
--un-contrast: ;
|
|
39
|
+
--un-drop-shadow: ;
|
|
40
|
+
--un-grayscale: ;
|
|
41
|
+
--un-hue-rotate: ;
|
|
42
|
+
--un-invert: ;
|
|
43
|
+
--un-saturate: ;
|
|
44
|
+
--un-sepia: ;
|
|
45
|
+
--un-backdrop-blur: ;
|
|
46
|
+
--un-backdrop-brightness: ;
|
|
47
|
+
--un-backdrop-contrast: ;
|
|
48
|
+
--un-backdrop-grayscale: ;
|
|
49
|
+
--un-backdrop-hue-rotate: ;
|
|
50
|
+
--un-backdrop-invert: ;
|
|
51
|
+
--un-backdrop-opacity: ;
|
|
52
|
+
--un-backdrop-saturate: ;
|
|
53
|
+
--un-backdrop-sepia: ;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.fairystaroform__box-border {
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.fairystaroform__flex {
|
|
61
|
+
display: flex;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.fairystaroform__flex-1 {
|
|
65
|
+
flex: 1;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.fairystaroform__flex-row {
|
|
69
|
+
flex-direction: row;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.fairystaroform__flex-col {
|
|
73
|
+
flex-direction: column;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.fairystaroform__flex-nowrap {
|
|
77
|
+
flex-wrap: nowrap;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.fairystaroform__cursor-pointer {
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.fairystaroform__items-center {
|
|
85
|
+
align-items: center;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.fairystaroform__justify-end {
|
|
89
|
+
justify-content: flex-end;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.fairystaroform__justify-between {
|
|
93
|
+
justify-content: space-between;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.fairystaroform__gap-1 {
|
|
97
|
+
gap: .25rem;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.fairystaroform__overflow-hidden {
|
|
101
|
+
overflow: hidden;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.fairystaroform__border-b-1 {
|
|
105
|
+
border-bottom-width: 1px;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.fairystaroform__border-b-gray-200 {
|
|
109
|
+
--un-border-opacity: 1;
|
|
110
|
+
--un-border-bottom-opacity: var(--un-border-opacity);
|
|
111
|
+
border-bottom-color: rgb(229 231 235 / var(--un-border-bottom-opacity));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.fairystaroform__border-b-solid {
|
|
115
|
+
border-bottom-style: solid;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.fairystaroform__px-1 {
|
|
119
|
+
padding-left: .25rem;
|
|
120
|
+
padding-right: .25rem;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.fairystaroform__px-2 {
|
|
124
|
+
padding-left: .5rem;
|
|
125
|
+
padding-right: .5rem;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.fairystaroform__py-2 {
|
|
129
|
+
padding-top: .5rem;
|
|
130
|
+
padding-bottom: .5rem;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.fairystaroform__pr-4 {
|
|
134
|
+
padding-right: 1rem;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
.fairystaroform__text-left {
|
|
138
|
+
text-align: left;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.fairystaroform__text-black {
|
|
142
|
+
--un-text-opacity: 1;
|
|
143
|
+
color: rgb(0 0 0 / var(--un-text-opacity));
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
.fairystaroform__text-gray-600 {
|
|
147
|
+
--un-text-opacity: 1;
|
|
148
|
+
color: rgb(75 85 99 / var(--un-text-opacity));
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.fairystaroform__font-normal {
|
|
152
|
+
font-weight: 400;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
.nut-cell.fairys-taro-popup-search-list-virtual-cell > .nut-cell-left > .nut-cell-title {
|
|
156
|
+
width: 100%;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.nut-cell.fairys-taro-popup-search-list-virtual-cell > .nut-cell-extra {
|
|
160
|
+
flex: none;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.fairys-taro-popup-search-list-table .nut-table-main-head-tr {
|
|
164
|
+
z-index: 10;
|
|
165
|
+
position: relative;
|
|
166
|
+
}
|
|
167
|
+
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./components": function(module) {
|
|
4
|
+
module.exports = require("./components/index.js");
|
|
5
|
+
},
|
|
6
|
+
"./item.config": function(module) {
|
|
7
|
+
module.exports = require("./item.config.js");
|
|
8
|
+
},
|
|
9
|
+
"@carefrees/form-utils-react-taro": function(module) {
|
|
10
|
+
module.exports = require("@carefrees/form-utils-react-taro");
|
|
11
|
+
},
|
|
12
|
+
"react/jsx-runtime": function(module) {
|
|
13
|
+
module.exports = require("react/jsx-runtime");
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
var __webpack_module_cache__ = {};
|
|
17
|
+
function __webpack_require__(moduleId) {
|
|
18
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
19
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
20
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
21
|
+
exports: {}
|
|
22
|
+
};
|
|
23
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
24
|
+
return module.exports;
|
|
25
|
+
}
|
|
26
|
+
(()=>{
|
|
27
|
+
__webpack_require__.n = (module)=>{
|
|
28
|
+
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
29
|
+
__webpack_require__.d(getter, {
|
|
30
|
+
a: getter
|
|
31
|
+
});
|
|
32
|
+
return getter;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
(()=>{
|
|
36
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
37
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: definition[key]
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
})();
|
|
43
|
+
(()=>{
|
|
44
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
45
|
+
})();
|
|
46
|
+
(()=>{
|
|
47
|
+
__webpack_require__.r = (exports1)=>{
|
|
48
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
49
|
+
value: 'Module'
|
|
50
|
+
});
|
|
51
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
52
|
+
value: true
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
})();
|
|
56
|
+
var __webpack_exports__ = {};
|
|
57
|
+
(()=>{
|
|
58
|
+
__webpack_require__.r(__webpack_exports__);
|
|
59
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
60
|
+
FairysTaroSimpleForm: ()=>FairysTaroSimpleForm
|
|
61
|
+
});
|
|
62
|
+
var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("react/jsx-runtime");
|
|
63
|
+
var _carefrees_form_utils_react_taro__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("@carefrees/form-utils-react-taro");
|
|
64
|
+
var _item_config__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("./item.config");
|
|
65
|
+
var _components__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("./components");
|
|
66
|
+
var __WEBPACK_REEXPORT_OBJECT__ = {};
|
|
67
|
+
for(var __WEBPACK_IMPORT_KEY__ in _components__WEBPACK_IMPORTED_MODULE_3__)if ([
|
|
68
|
+
"default",
|
|
69
|
+
"FairysTaroSimpleForm"
|
|
70
|
+
].indexOf(__WEBPACK_IMPORT_KEY__) < 0) __WEBPACK_REEXPORT_OBJECT__[__WEBPACK_IMPORT_KEY__] = (function(key) {
|
|
71
|
+
return _components__WEBPACK_IMPORTED_MODULE_3__[key];
|
|
72
|
+
}).bind(0, __WEBPACK_IMPORT_KEY__);
|
|
73
|
+
__webpack_require__.d(__webpack_exports__, __WEBPACK_REEXPORT_OBJECT__);
|
|
74
|
+
const FairysTaroSimpleForm = (props)=>/*#__PURE__*/ (0, react_jsx_runtime__WEBPACK_IMPORTED_MODULE_0__.jsx)(_carefrees_form_utils_react_taro__WEBPACK_IMPORTED_MODULE_1__.Form, {
|
|
75
|
+
labelMode: "between",
|
|
76
|
+
colCount: 1,
|
|
77
|
+
inputBordered: false,
|
|
78
|
+
...props
|
|
79
|
+
});
|
|
80
|
+
FairysTaroSimpleForm.Item = _item_config__WEBPACK_IMPORTED_MODULE_2__.ConfigItem;
|
|
81
|
+
FairysTaroSimpleForm.ListItem = _item_config__WEBPACK_IMPORTED_MODULE_2__.ConfigListItem;
|
|
82
|
+
FairysTaroSimpleForm.useForm = _carefrees_form_utils_react_taro__WEBPACK_IMPORTED_MODULE_1__.useForm;
|
|
83
|
+
FairysTaroSimpleForm.useWatch = _carefrees_form_utils_react_taro__WEBPACK_IMPORTED_MODULE_1__.useWatch;
|
|
84
|
+
})();
|
|
85
|
+
exports.FairysTaroSimpleForm = __webpack_exports__.FairysTaroSimpleForm;
|
|
86
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
87
|
+
"FairysTaroSimpleForm"
|
|
88
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
89
|
+
Object.defineProperty(exports, '__esModule', {
|
|
90
|
+
value: true
|
|
91
|
+
});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"author": "SunLxy <1011771396@qq.com>",
|
|
4
4
|
"description": "框架组件库",
|
|
5
5
|
"homepage": "https://github.com/autumn-fairy-tales/fairys-taro-react",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.3",
|
|
7
7
|
"main": "lib/index.js",
|
|
8
8
|
"types": "esm/index.d.ts",
|
|
9
9
|
"module": "esm/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"esm"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@carefrees/form-utils-react-taro": "^0.0.
|
|
28
|
+
"@carefrees/form-utils-react-taro": "^0.0.17",
|
|
29
29
|
"@nutui/nutui-react-taro": "^3.0.18",
|
|
30
30
|
"clsx": "2.1.1",
|
|
31
31
|
"valtio": "~2.1.5"
|