@fairys/taro-tools-simple-form 0.0.2 → 0.0.4
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/README.md +320 -1
- 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,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.4",
|
|
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"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { View,
|
|
1
|
+
import { View, ViewProps } from '@tarojs/components';
|
|
2
2
|
import { Calendar, CalendarProps } from '@nutui/nutui-react-taro';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { FairysTaroTextClearBase } from 'components/clear';
|
|
5
5
|
|
|
6
6
|
export interface FairysTaroCalendarProps extends Partial<CalendarProps> {
|
|
7
7
|
placeholder?: string;
|
|
@@ -14,18 +14,17 @@ export interface FairysTaroCalendarProps extends Partial<CalendarProps> {
|
|
|
14
14
|
export const FairysTaroCalendarBase = (props: FairysTaroCalendarProps) => {
|
|
15
15
|
const { placeholder = '请选择', value, className, style, onChange, ...rest } = props;
|
|
16
16
|
const [visible, setVisible] = useState(false);
|
|
17
|
-
const clsx_text = useMemo(() => {
|
|
18
|
-
return clsx('fairys-taro-calendar-text', {
|
|
19
|
-
'fairys-taro-calendar-text-placeholder fairystaroform__text-gray-600 fairystaroform__font-normal': !value,
|
|
20
|
-
'fairys-taro-calendar-text-value fairystaroform__text-black': value,
|
|
21
|
-
});
|
|
22
|
-
}, [value]);
|
|
23
17
|
|
|
24
18
|
return (
|
|
25
19
|
<View className={`fairys-taro-calendar ${className || ''}`} style={style}>
|
|
26
|
-
<
|
|
20
|
+
<FairysTaroTextClearBase
|
|
21
|
+
warpClassName="fairys-taro-calendar-text"
|
|
22
|
+
isValue={!!value}
|
|
23
|
+
onTextClick={() => setVisible(true)}
|
|
24
|
+
onClearClick={() => onChange?.(undefined, undefined)}
|
|
25
|
+
>
|
|
27
26
|
{value || placeholder}
|
|
28
|
-
</
|
|
27
|
+
</FairysTaroTextClearBase>
|
|
29
28
|
<Calendar
|
|
30
29
|
{...rest}
|
|
31
30
|
visible={visible}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { View
|
|
1
|
+
import { View } from '@tarojs/components';
|
|
2
2
|
import { Cascader, CascaderProps, CascaderOption } from '@nutui/nutui-react-taro';
|
|
3
3
|
import { useMemo, useState } from 'react';
|
|
4
|
-
import
|
|
4
|
+
import { FairysTaroTextClearBase } from 'components/clear';
|
|
5
5
|
|
|
6
6
|
export interface FairysTaroCascaderProps
|
|
7
7
|
extends Omit<Partial<CascaderProps>, 'visible' | 'onClose' | 'onChange' | 'value'> {
|
|
@@ -74,13 +74,6 @@ export const FairysTaroCascaderBase = (props: FairysTaroCascaderProps) => {
|
|
|
74
74
|
return '';
|
|
75
75
|
}, [value, labelInValue, valueKey, textKey]);
|
|
76
76
|
|
|
77
|
-
const clsx_text = useMemo(() => {
|
|
78
|
-
return clsx('fairys-taro-cascader-text', {
|
|
79
|
-
'fairys-taro-cascader-text-placeholder fairystaroform__text-gray-600 fairystaroform__font-normal': !render,
|
|
80
|
-
'fairys-taro-cascader-text-value fairystaroform__text-black': render,
|
|
81
|
-
});
|
|
82
|
-
}, [render]);
|
|
83
|
-
|
|
84
77
|
const _value = useMemo(() => {
|
|
85
78
|
if (Array.isArray(value) && value.length) {
|
|
86
79
|
return value
|
|
@@ -100,9 +93,14 @@ export const FairysTaroCascaderBase = (props: FairysTaroCascaderProps) => {
|
|
|
100
93
|
|
|
101
94
|
return (
|
|
102
95
|
<View className={`fairys-taro-cascader ${className || ''}`} style={style}>
|
|
103
|
-
<
|
|
96
|
+
<FairysTaroTextClearBase
|
|
97
|
+
warpClassName="fairys-taro-cascader-text"
|
|
98
|
+
isValue={!!render}
|
|
99
|
+
onTextClick={() => setVisible(true)}
|
|
100
|
+
onClearClick={() => onChange?.(undefined, undefined)}
|
|
101
|
+
>
|
|
104
102
|
{render || placeholder}
|
|
105
|
-
</
|
|
103
|
+
</FairysTaroTextClearBase>
|
|
106
104
|
<Cascader
|
|
107
105
|
{...rest}
|
|
108
106
|
className={`fairys-taro-cascader-body fairystaroform__text-left ${bodyClassName || ''}`}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Close2 } from '@nutui/icons-react-taro';
|
|
2
|
+
import { View, Text, ITouchEvent } from '@tarojs/components';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { Fragment, useMemo } from 'react';
|
|
5
|
+
|
|
6
|
+
export interface SVG_IconProps {
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
viewBox?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
color?: string;
|
|
12
|
+
width?: string | number;
|
|
13
|
+
height?: string | number;
|
|
14
|
+
size?: string | number;
|
|
15
|
+
svg64?: string;
|
|
16
|
+
svgSrc?: string;
|
|
17
|
+
children?: React.ReactNode;
|
|
18
|
+
fallback?: boolean;
|
|
19
|
+
isValue?: boolean;
|
|
20
|
+
warpClassName?: string;
|
|
21
|
+
warpStyle?: React.CSSProperties;
|
|
22
|
+
onTextClick?: (event: ITouchEvent) => void;
|
|
23
|
+
onClearClick?: (event: React.MouseEvent) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const FairysTaroTextClearBase = (props: SVG_IconProps) => {
|
|
27
|
+
const { isValue = true, children, warpClassName, warpStyle, onTextClick, onClearClick, ...rest } = props;
|
|
28
|
+
|
|
29
|
+
const clsx_text = useMemo(() => {
|
|
30
|
+
return clsx('fairys-taro-text fairystaroform__flex-1', {
|
|
31
|
+
'fairys-taro-text-placeholder fairystaroform__text-gray-600 fairystaroform__font-normal': !isValue,
|
|
32
|
+
'fairys-taro-text-value fairystaroform__text-black': isValue,
|
|
33
|
+
});
|
|
34
|
+
}, [isValue]);
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<View
|
|
38
|
+
className={`fairys-taro-clear fairystaroform__flex fairystaroform__items-center fairystaroform__gap-1 ${
|
|
39
|
+
warpClassName || ''
|
|
40
|
+
}`}
|
|
41
|
+
style={warpStyle}
|
|
42
|
+
>
|
|
43
|
+
<Text onClick={onTextClick} className={clsx_text}>
|
|
44
|
+
{children}
|
|
45
|
+
</Text>
|
|
46
|
+
{isValue ? <Close2 color="#c2c4cc" onClick={onClearClick} {...rest} /> : <Fragment />}
|
|
47
|
+
</View>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { View
|
|
2
|
-
import { DatePicker, DatePickerProps
|
|
1
|
+
import { View } from '@tarojs/components';
|
|
2
|
+
import { DatePicker, DatePickerProps } from '@nutui/nutui-react-taro';
|
|
3
3
|
import { useMemo, useState } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
|
+
import { FairysTaroTextClearBase } from 'components/clear';
|
|
5
6
|
|
|
6
7
|
export interface FairysTaroDatePickerProps extends Omit<Partial<DatePickerProps>, 'value' | 'onChange'> {
|
|
7
8
|
placeholder?: string;
|
|
@@ -131,22 +132,21 @@ export const FairysTaroDatePickerBase = (props: FairysTaroDatePickerProps) => {
|
|
|
131
132
|
const { placeholder = '请选择', value, className, style, onChange, type = 'date', ...rest } = props;
|
|
132
133
|
const [visible, setVisible] = useState(false);
|
|
133
134
|
|
|
134
|
-
const clsx_text = useMemo(() => {
|
|
135
|
-
return clsx('fairys-taro-date-picker-text', {
|
|
136
|
-
'fairys-taro-date-picker-text-placeholder fairystaroform__text-gray-600 fairystaroform__font-normal': !value,
|
|
137
|
-
'fairys-taro-date-picker-text-value fairystaroform__text-black': value,
|
|
138
|
-
});
|
|
139
|
-
}, [value]);
|
|
140
|
-
|
|
141
135
|
const render = useMemo(() => {
|
|
142
136
|
return renderDate(value, type);
|
|
143
137
|
}, [value, type]);
|
|
144
138
|
|
|
145
139
|
return (
|
|
146
140
|
<View className={`fairys-taro-date-picker ${className || ''}`} style={style}>
|
|
147
|
-
<
|
|
141
|
+
<FairysTaroTextClearBase
|
|
142
|
+
warpClassName="fairys-taro-date-picker-text"
|
|
143
|
+
isValue={!!render.renderStr}
|
|
144
|
+
onTextClick={() => setVisible(true)}
|
|
145
|
+
onClearClick={() => onChange?.(undefined)}
|
|
146
|
+
>
|
|
148
147
|
{render.renderStr || placeholder}
|
|
149
|
-
</
|
|
148
|
+
</FairysTaroTextClearBase>
|
|
149
|
+
|
|
150
150
|
<DatePicker
|
|
151
151
|
type={type}
|
|
152
152
|
showChinese
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { View
|
|
1
|
+
import { View } from '@tarojs/components';
|
|
2
2
|
import { Picker, TaroPickerProps, PickerOptions } from '@nutui/nutui-react-taro';
|
|
3
3
|
import { useMemo, useState } from 'react';
|
|
4
|
-
import
|
|
4
|
+
import { FairysTaroTextClearBase } from 'components/clear';
|
|
5
5
|
|
|
6
6
|
export interface FairysTaroPickerProps extends Omit<Partial<TaroPickerProps>, 'value' | 'onChange'> {
|
|
7
7
|
placeholder?: string;
|
|
@@ -23,13 +23,6 @@ export const FairysTaroPickerBase = (props: FairysTaroPickerProps) => {
|
|
|
23
23
|
return undefined;
|
|
24
24
|
}, [value]);
|
|
25
25
|
|
|
26
|
-
const clsx_text = useMemo(() => {
|
|
27
|
-
return clsx('fairys-taro-picker-text', {
|
|
28
|
-
'fairys-taro-picker-text-placeholder fairystaroform__text-gray-600 fairystaroform__font-normal': !_renderValue,
|
|
29
|
-
'fairys-taro-picker-text-value fairystaroform__text-black': _renderValue,
|
|
30
|
-
});
|
|
31
|
-
}, [_renderValue]);
|
|
32
|
-
|
|
33
26
|
const _value = useMemo(() => {
|
|
34
27
|
if (Array.isArray(value)) {
|
|
35
28
|
return value.map((item) => item.value);
|
|
@@ -39,9 +32,14 @@ export const FairysTaroPickerBase = (props: FairysTaroPickerProps) => {
|
|
|
39
32
|
|
|
40
33
|
return (
|
|
41
34
|
<View className={`fairys-taro-picker ${className || ''}`} style={style}>
|
|
42
|
-
<
|
|
35
|
+
<FairysTaroTextClearBase
|
|
36
|
+
warpClassName="fairys-taro-picker-text"
|
|
37
|
+
isValue={!!_renderValue}
|
|
38
|
+
onTextClick={() => setVisible(true)}
|
|
39
|
+
onClearClick={() => onChange?.(undefined)}
|
|
40
|
+
>
|
|
43
41
|
{_renderValue || placeholder}
|
|
44
|
-
</
|
|
42
|
+
</FairysTaroTextClearBase>
|
|
45
43
|
<Picker
|
|
46
44
|
{...rest}
|
|
47
45
|
className={`fairys-taro-picker-body fairystaroform__text-left ${bodyClassName || ''}`}
|