@sheinx/hooks 3.8.0-beta.31 → 3.8.0-beta.33
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/cjs/components/use-form/use-form-schema/form-schema-builder.d.ts +2 -1
- package/cjs/components/use-form/use-form-schema/form-schema-builder.d.ts.map +1 -1
- package/cjs/components/use-form/use-form-schema/form-schema-builder.js +89 -46
- package/esm/components/use-form/use-form-schema/form-schema-builder.d.ts +2 -1
- package/esm/components/use-form/use-form-schema/form-schema-builder.d.ts.map +1 -1
- package/esm/components/use-form/use-form-schema/form-schema-builder.js +89 -46
- package/package.json +1 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"form-schema-builder.d.ts","sourceRoot":"","sources":["form-schema-builder.ts"],"names":[],"mappings":"AAAA,UAAU,UAAU;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG;QAAE,KAAK,EAAE,GAAG,EAAE,CAAA;KAAE,CAAC;
|
1
|
+
{"version":3,"file":"form-schema-builder.d.ts","sourceRoot":"","sources":["form-schema-builder.ts"],"names":[],"mappings":"AAAA,UAAU,UAAU;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,IAAI,CAAC,EAAE,GAAG,EAAE,GAAG;QAAE,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAA;KAAE,CAAC;IAChD,WAAW,CAAC,EAAE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,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;IA0B9H,cAAc,CAAC,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI;IAwB7F,aAAa,IAAI,cAAc;CAGhC"}
|
@@ -74,29 +74,25 @@ var SchemaBuilder = exports.SchemaBuilder = /*#__PURE__*/function () {
|
|
74
74
|
var itemType;
|
75
75
|
if (typeof componentElement.type === 'function') {
|
76
76
|
var componentName = componentElement.type.displayName || componentElement.type.name;
|
77
|
+
var format = componentElement.props.format || componentElement.props.keygen;
|
77
78
|
switch (componentName) {
|
78
79
|
case 'ShineoutInput':
|
79
|
-
case '
|
80
|
+
case 'ShineoutEditableArea':
|
80
81
|
fieldSchemaInfo.type = 'string';
|
81
82
|
break;
|
82
83
|
case 'ShineoutInputNumber':
|
83
|
-
case 'InputNumber':
|
84
84
|
fieldSchemaInfo.type = 'number';
|
85
85
|
break;
|
86
86
|
case 'ShineoutInputPassword':
|
87
|
-
case 'InputPassword':
|
88
87
|
fieldSchemaInfo.type = 'string';
|
89
88
|
break;
|
90
89
|
case 'ShineoutTextarea':
|
91
|
-
case 'Textarea':
|
92
90
|
fieldSchemaInfo.type = 'string';
|
93
91
|
break;
|
92
|
+
case 'ShineoutCascader':
|
94
93
|
case 'ShineoutSelect':
|
95
|
-
case 'Select':
|
96
94
|
case 'ShineoutTreeSelect':
|
97
|
-
case 'TreeSelect':
|
98
95
|
{
|
99
|
-
var format = componentElement.props.format || componentElement.props.keygen;
|
100
96
|
if (typeof componentElement.props.keygen !== 'boolean') {
|
101
97
|
if (typeof format === 'string') {
|
102
98
|
var _data$;
|
@@ -117,35 +113,31 @@ var SchemaBuilder = exports.SchemaBuilder = /*#__PURE__*/function () {
|
|
117
113
|
} else {
|
118
114
|
fieldSchemaInfo.type = itemType;
|
119
115
|
}
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
return
|
140
|
-
|
141
|
-
|
142
|
-
};
|
143
|
-
})
|
144
|
-
};
|
116
|
+
if (itemType === 'object') {
|
117
|
+
// 对于对象类型,使用 oneOf 而不是 enum
|
118
|
+
if (componentElement.props.multiple) {
|
119
|
+
fieldSchemaInfo.items.oneOf = componentElement.props.data.map(function (item) {
|
120
|
+
return {
|
121
|
+
const: item,
|
122
|
+
title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
|
123
|
+
};
|
124
|
+
});
|
125
|
+
} else {
|
126
|
+
fieldSchemaInfo.oneOf = componentElement.props.data.map(function (item) {
|
127
|
+
return {
|
128
|
+
const: item,
|
129
|
+
title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
|
130
|
+
};
|
131
|
+
});
|
132
|
+
}
|
133
|
+
} else {
|
134
|
+
fieldSchemaInfo.enum = componentElement.props.data.map(function (item) {
|
135
|
+
return (item === null || item === void 0 ? void 0 : item[format]) || item;
|
136
|
+
});
|
137
|
+
}
|
145
138
|
break;
|
146
139
|
}
|
147
140
|
case 'ShineoutDatePicker':
|
148
|
-
case 'DatePicker':
|
149
141
|
if (componentElement.props.range) {
|
150
142
|
if (finalFieldId !== null && finalFieldId !== void 0 && finalFieldId.includes(separator || '')) {
|
151
143
|
fieldSchemaInfo.type = 'string';
|
@@ -164,26 +156,77 @@ var SchemaBuilder = exports.SchemaBuilder = /*#__PURE__*/function () {
|
|
164
156
|
fieldSchemaInfo.description += "\u9ED8\u8BA4\u65F6\u95F4\uFF1A".concat(((_componentElement$pro = componentElement.props.defaultTime) === null || _componentElement$pro === void 0 ? void 0 : _componentElement$pro.toString()) || '', "; \u683C\u5F0F\uFF1A").concat(componentElement.props.format || '', " ");
|
165
157
|
break;
|
166
158
|
case 'ShineoutCheckbox':
|
167
|
-
case 'Checkbox':
|
168
159
|
case 'ShineoutCheckboxGroup':
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
160
|
+
{
|
161
|
+
if (typeof componentElement.props.keygen !== 'boolean') {
|
162
|
+
if (typeof format === 'string') {
|
163
|
+
var _data$2;
|
164
|
+
itemType = _typeof(data === null || data === void 0 ? void 0 : data[0]) === 'object' ? _typeof(data === null || data === void 0 || (_data$2 = data[0]) === null || _data$2 === void 0 ? void 0 : _data$2[format]) : _typeof(data === null || data === void 0 ? void 0 : data[0]);
|
165
|
+
} else if (typeof format === 'function') {
|
166
|
+
itemType = _typeof(format(data === null || data === void 0 ? void 0 : data[0]));
|
167
|
+
} else {
|
168
|
+
itemType = _typeof(data === null || data === void 0 ? void 0 : data[0]);
|
169
|
+
}
|
170
|
+
} else {
|
171
|
+
itemType = _typeof(data === null || data === void 0 ? void 0 : data[0]);
|
172
|
+
}
|
173
|
+
fieldSchemaInfo.type = 'array';
|
174
|
+
fieldSchemaInfo.items = {
|
175
|
+
type: itemType
|
176
|
+
};
|
177
|
+
|
178
|
+
// ShineoutCheckboxGroup 有 data 时(多选的)
|
179
|
+
if (itemType === 'object') {
|
180
|
+
fieldSchemaInfo.items.oneOf = componentElement.props.data.map(function (item) {
|
181
|
+
return {
|
182
|
+
const: item,
|
183
|
+
title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
|
184
|
+
};
|
185
|
+
});
|
186
|
+
} else {
|
187
|
+
fieldSchemaInfo.items.enum = componentElement.props.data.map(function (item) {
|
188
|
+
return (item === null || item === void 0 ? void 0 : item[format]) || item;
|
189
|
+
});
|
190
|
+
}
|
191
|
+
break;
|
192
|
+
}
|
175
193
|
case 'ShineoutRadio':
|
176
|
-
case 'Radio':
|
177
194
|
case 'ShineoutRadioGroup':
|
178
|
-
|
179
|
-
|
180
|
-
|
195
|
+
{
|
196
|
+
if (typeof componentElement.props.keygen !== 'boolean') {
|
197
|
+
if (typeof format === 'string') {
|
198
|
+
var _data$3;
|
199
|
+
itemType = _typeof(data === null || data === void 0 ? void 0 : data[0]) === 'object' ? _typeof(data === null || data === void 0 || (_data$3 = data[0]) === null || _data$3 === void 0 ? void 0 : _data$3[format]) : _typeof(data === null || data === void 0 ? void 0 : data[0]);
|
200
|
+
} else if (typeof format === 'function') {
|
201
|
+
itemType = _typeof(format(data === null || data === void 0 ? void 0 : data[0]));
|
202
|
+
} else {
|
203
|
+
itemType = _typeof(data === null || data === void 0 ? void 0 : data[0]);
|
204
|
+
}
|
205
|
+
} else {
|
206
|
+
itemType = _typeof(data === null || data === void 0 ? void 0 : data[0]);
|
207
|
+
}
|
208
|
+
fieldSchemaInfo.type = itemType;
|
209
|
+
|
210
|
+
// ShineoutRadioGroup 有 data 时(单选的)
|
211
|
+
if (itemType === 'object') {
|
212
|
+
fieldSchemaInfo.oneOf = componentElement.props.data.map(function (item) {
|
213
|
+
return {
|
214
|
+
const: item,
|
215
|
+
title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
|
216
|
+
};
|
217
|
+
});
|
218
|
+
} else {
|
219
|
+
fieldSchemaInfo.enum = componentElement.props.data.map(function (item) {
|
220
|
+
return (item === null || item === void 0 ? void 0 : item[format]) || item;
|
221
|
+
});
|
222
|
+
}
|
223
|
+
break;
|
224
|
+
}
|
181
225
|
case 'ShineoutSwitch':
|
182
|
-
case 'Switch':
|
183
226
|
fieldSchemaInfo.type = 'boolean';
|
184
227
|
break;
|
228
|
+
case 'ShineoutSlider':
|
185
229
|
case 'ShineoutRate':
|
186
|
-
case 'Rate':
|
187
230
|
fieldSchemaInfo.type = 'number';
|
188
231
|
break;
|
189
232
|
default:
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"form-schema-builder.d.ts","sourceRoot":"","sources":["form-schema-builder.ts"],"names":[],"mappings":"AAAA,UAAU,UAAU;IAClB,I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Q,EAAE,MAAM;IAQ5B,YAAY,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,UAAU,CAAA;KAAE,GAAG,IAAI;IAMtE;;OAEG;IACH,wBAAwB,CAAC,MAAM,EAAE;QAC/B,gBAAgB,EAAE,GAAG,CAAC;QACtB,KAAK,CAAC,EAAE,GAAG,EAAE,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,UAAU;IAmLd,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,IAAI;IAuCzC,WAAW,CAAC,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;IAkB1F,kBAAkB,CAAC,aAAa,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;IAatG,oBAAoB,CAAC,aAAa,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI;IA0B9H,cAAc,CAAC,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,GAAG,IAAI;IAwB7F,aAAa,IAAI,cAAc;CAGhC"}
|
@@ -68,29 +68,25 @@ export var SchemaBuilder = /*#__PURE__*/function () {
|
|
68
68
|
var itemType;
|
69
69
|
if (typeof componentElement.type === 'function') {
|
70
70
|
var componentName = componentElement.type.displayName || componentElement.type.name;
|
71
|
+
var format = componentElement.props.format || componentElement.props.keygen;
|
71
72
|
switch (componentName) {
|
72
73
|
case 'ShineoutInput':
|
73
|
-
case '
|
74
|
+
case 'ShineoutEditableArea':
|
74
75
|
fieldSchemaInfo.type = 'string';
|
75
76
|
break;
|
76
77
|
case 'ShineoutInputNumber':
|
77
|
-
case 'InputNumber':
|
78
78
|
fieldSchemaInfo.type = 'number';
|
79
79
|
break;
|
80
80
|
case 'ShineoutInputPassword':
|
81
|
-
case 'InputPassword':
|
82
81
|
fieldSchemaInfo.type = 'string';
|
83
82
|
break;
|
84
83
|
case 'ShineoutTextarea':
|
85
|
-
case 'Textarea':
|
86
84
|
fieldSchemaInfo.type = 'string';
|
87
85
|
break;
|
86
|
+
case 'ShineoutCascader':
|
88
87
|
case 'ShineoutSelect':
|
89
|
-
case 'Select':
|
90
88
|
case 'ShineoutTreeSelect':
|
91
|
-
case 'TreeSelect':
|
92
89
|
{
|
93
|
-
var format = componentElement.props.format || componentElement.props.keygen;
|
94
90
|
if (typeof componentElement.props.keygen !== 'boolean') {
|
95
91
|
if (typeof format === 'string') {
|
96
92
|
var _data$;
|
@@ -111,35 +107,31 @@ export var SchemaBuilder = /*#__PURE__*/function () {
|
|
111
107
|
} else {
|
112
108
|
fieldSchemaInfo.type = itemType;
|
113
109
|
}
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
return
|
134
|
-
|
135
|
-
|
136
|
-
};
|
137
|
-
})
|
138
|
-
};
|
110
|
+
if (itemType === 'object') {
|
111
|
+
// 对于对象类型,使用 oneOf 而不是 enum
|
112
|
+
if (componentElement.props.multiple) {
|
113
|
+
fieldSchemaInfo.items.oneOf = componentElement.props.data.map(function (item) {
|
114
|
+
return {
|
115
|
+
const: item,
|
116
|
+
title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
|
117
|
+
};
|
118
|
+
});
|
119
|
+
} else {
|
120
|
+
fieldSchemaInfo.oneOf = componentElement.props.data.map(function (item) {
|
121
|
+
return {
|
122
|
+
const: item,
|
123
|
+
title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
|
124
|
+
};
|
125
|
+
});
|
126
|
+
}
|
127
|
+
} else {
|
128
|
+
fieldSchemaInfo.enum = componentElement.props.data.map(function (item) {
|
129
|
+
return (item === null || item === void 0 ? void 0 : item[format]) || item;
|
130
|
+
});
|
131
|
+
}
|
139
132
|
break;
|
140
133
|
}
|
141
134
|
case 'ShineoutDatePicker':
|
142
|
-
case 'DatePicker':
|
143
135
|
if (componentElement.props.range) {
|
144
136
|
if (finalFieldId !== null && finalFieldId !== void 0 && finalFieldId.includes(separator || '')) {
|
145
137
|
fieldSchemaInfo.type = 'string';
|
@@ -158,26 +150,77 @@ export var SchemaBuilder = /*#__PURE__*/function () {
|
|
158
150
|
fieldSchemaInfo.description += "\u9ED8\u8BA4\u65F6\u95F4\uFF1A".concat(((_componentElement$pro = componentElement.props.defaultTime) === null || _componentElement$pro === void 0 ? void 0 : _componentElement$pro.toString()) || '', "; \u683C\u5F0F\uFF1A").concat(componentElement.props.format || '', " ");
|
159
151
|
break;
|
160
152
|
case 'ShineoutCheckbox':
|
161
|
-
case 'Checkbox':
|
162
153
|
case 'ShineoutCheckboxGroup':
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
154
|
+
{
|
155
|
+
if (typeof componentElement.props.keygen !== 'boolean') {
|
156
|
+
if (typeof format === 'string') {
|
157
|
+
var _data$2;
|
158
|
+
itemType = _typeof(data === null || data === void 0 ? void 0 : data[0]) === 'object' ? _typeof(data === null || data === void 0 || (_data$2 = data[0]) === null || _data$2 === void 0 ? void 0 : _data$2[format]) : _typeof(data === null || data === void 0 ? void 0 : data[0]);
|
159
|
+
} else if (typeof format === 'function') {
|
160
|
+
itemType = _typeof(format(data === null || data === void 0 ? void 0 : data[0]));
|
161
|
+
} else {
|
162
|
+
itemType = _typeof(data === null || data === void 0 ? void 0 : data[0]);
|
163
|
+
}
|
164
|
+
} else {
|
165
|
+
itemType = _typeof(data === null || data === void 0 ? void 0 : data[0]);
|
166
|
+
}
|
167
|
+
fieldSchemaInfo.type = 'array';
|
168
|
+
fieldSchemaInfo.items = {
|
169
|
+
type: itemType
|
170
|
+
};
|
171
|
+
|
172
|
+
// ShineoutCheckboxGroup 有 data 时(多选的)
|
173
|
+
if (itemType === 'object') {
|
174
|
+
fieldSchemaInfo.items.oneOf = componentElement.props.data.map(function (item) {
|
175
|
+
return {
|
176
|
+
const: item,
|
177
|
+
title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
|
178
|
+
};
|
179
|
+
});
|
180
|
+
} else {
|
181
|
+
fieldSchemaInfo.items.enum = componentElement.props.data.map(function (item) {
|
182
|
+
return (item === null || item === void 0 ? void 0 : item[format]) || item;
|
183
|
+
});
|
184
|
+
}
|
185
|
+
break;
|
186
|
+
}
|
169
187
|
case 'ShineoutRadio':
|
170
|
-
case 'Radio':
|
171
188
|
case 'ShineoutRadioGroup':
|
172
|
-
|
173
|
-
|
174
|
-
|
189
|
+
{
|
190
|
+
if (typeof componentElement.props.keygen !== 'boolean') {
|
191
|
+
if (typeof format === 'string') {
|
192
|
+
var _data$3;
|
193
|
+
itemType = _typeof(data === null || data === void 0 ? void 0 : data[0]) === 'object' ? _typeof(data === null || data === void 0 || (_data$3 = data[0]) === null || _data$3 === void 0 ? void 0 : _data$3[format]) : _typeof(data === null || data === void 0 ? void 0 : data[0]);
|
194
|
+
} else if (typeof format === 'function') {
|
195
|
+
itemType = _typeof(format(data === null || data === void 0 ? void 0 : data[0]));
|
196
|
+
} else {
|
197
|
+
itemType = _typeof(data === null || data === void 0 ? void 0 : data[0]);
|
198
|
+
}
|
199
|
+
} else {
|
200
|
+
itemType = _typeof(data === null || data === void 0 ? void 0 : data[0]);
|
201
|
+
}
|
202
|
+
fieldSchemaInfo.type = itemType;
|
203
|
+
|
204
|
+
// ShineoutRadioGroup 有 data 时(单选的)
|
205
|
+
if (itemType === 'object') {
|
206
|
+
fieldSchemaInfo.oneOf = componentElement.props.data.map(function (item) {
|
207
|
+
return {
|
208
|
+
const: item,
|
209
|
+
title: (item === null || item === void 0 ? void 0 : item.title) || JSON.stringify(item)
|
210
|
+
};
|
211
|
+
});
|
212
|
+
} else {
|
213
|
+
fieldSchemaInfo.enum = componentElement.props.data.map(function (item) {
|
214
|
+
return (item === null || item === void 0 ? void 0 : item[format]) || item;
|
215
|
+
});
|
216
|
+
}
|
217
|
+
break;
|
218
|
+
}
|
175
219
|
case 'ShineoutSwitch':
|
176
|
-
case 'Switch':
|
177
220
|
fieldSchemaInfo.type = 'boolean';
|
178
221
|
break;
|
222
|
+
case 'ShineoutSlider':
|
179
223
|
case 'ShineoutRate':
|
180
|
-
case 'Rate':
|
181
224
|
fieldSchemaInfo.type = 'number';
|
182
225
|
break;
|
183
226
|
default:
|