@sheinx/hooks 3.9.3-beta.5 → 3.9.3-beta.7
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.map +1 -1
- package/cjs/components/use-form/use-form-schema/form-schema-builder.js +58 -53
- 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 +58 -53
- 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,CAAC,EAAE,GAAG,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAA;KAAE,CAAC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAA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@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
14
14
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
15
15
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
16
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
19
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
18
20
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
19
21
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
@@ -60,7 +62,6 @@ var SchemaBuilder = exports.SchemaBuilder = /*#__PURE__*/function () {
|
|
|
60
62
|
}, {
|
|
61
63
|
key: "buildSchemaFromComponent",
|
|
62
64
|
value: function buildSchemaFromComponent(params) {
|
|
63
|
-
var _componentElement$pro;
|
|
64
65
|
var componentElement = params.componentElement,
|
|
65
66
|
rules = params.rules,
|
|
66
67
|
label = params.label,
|
|
@@ -159,65 +160,69 @@ var SchemaBuilder = exports.SchemaBuilder = /*#__PURE__*/function () {
|
|
|
159
160
|
if (componentElement.props.data.length > 0) {
|
|
160
161
|
fieldSchemaInfo.description += "enumData: ".concat(JSON.stringify(componentElement.props.data), ";");
|
|
161
162
|
}
|
|
163
|
+
fieldSchemaInfo.props = _objectSpread({}, componentElement.props);
|
|
162
164
|
break;
|
|
163
165
|
}
|
|
164
166
|
case 'ShineoutDatePicker':
|
|
165
|
-
|
|
166
|
-
|
|
167
|
+
{
|
|
168
|
+
var _componentElement$pro;
|
|
169
|
+
if (componentElement.props.range) {
|
|
170
|
+
if (finalFieldId !== null && finalFieldId !== void 0 && finalFieldId.includes(separator || '')) {
|
|
171
|
+
fieldSchemaInfo.type = 'string';
|
|
172
|
+
fieldSchemaInfo.format = 'date';
|
|
173
|
+
} else {
|
|
174
|
+
fieldSchemaInfo.type = 'array';
|
|
175
|
+
fieldSchemaInfo.items = {
|
|
176
|
+
type: 'string',
|
|
177
|
+
format: 'date'
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
} else {
|
|
167
181
|
fieldSchemaInfo.type = 'string';
|
|
168
182
|
fieldSchemaInfo.format = 'date';
|
|
169
|
-
} else {
|
|
170
|
-
fieldSchemaInfo.type = 'array';
|
|
171
|
-
fieldSchemaInfo.items = {
|
|
172
|
-
type: 'string',
|
|
173
|
-
format: 'date'
|
|
174
|
-
};
|
|
175
183
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
}
|
|
180
|
-
var defaultTime = ((_componentElement$pro = componentElement.props.defaultTime) === null || _componentElement$pro === void 0 ? void 0 : _componentElement$pro.toString()) || '';
|
|
181
|
-
if (defaultTime) {
|
|
182
|
-
fieldSchemaInfo.description += "\u9ED8\u8BA4\u65F6\u95F4\uFF1A".concat(defaultTime, " ");
|
|
183
|
-
}
|
|
184
|
-
var dateformat = componentElement.props.format || '';
|
|
185
|
-
if (!dateformat) {
|
|
186
|
-
switch (componentElement.props.type) {
|
|
187
|
-
case 'date':
|
|
188
|
-
dateformat = 'YYYY-MM-DD';
|
|
189
|
-
break;
|
|
190
|
-
case 'time':
|
|
191
|
-
dateformat = 'HH:mm:ss';
|
|
192
|
-
break;
|
|
193
|
-
case 'datetime':
|
|
194
|
-
dateformat = 'YYYY-MM-DD HH:mm:ss';
|
|
195
|
-
break;
|
|
196
|
-
case 'week':
|
|
197
|
-
dateformat = 'GGGG WW';
|
|
198
|
-
break;
|
|
199
|
-
case 'month':
|
|
200
|
-
dateformat = 'YYYY-MM';
|
|
201
|
-
break;
|
|
202
|
-
case 'quarter':
|
|
203
|
-
dateformat = 'YYYY-\[Q]Q';
|
|
204
|
-
break;
|
|
205
|
-
case 'year':
|
|
206
|
-
dateformat = 'YYYY';
|
|
207
|
-
break;
|
|
208
|
-
default:
|
|
209
|
-
dateformat = 'YYYY-MM-DD';
|
|
210
|
-
break;
|
|
184
|
+
var defaultTime = ((_componentElement$pro = componentElement.props.defaultTime) === null || _componentElement$pro === void 0 ? void 0 : _componentElement$pro.toString()) || '';
|
|
185
|
+
if (defaultTime) {
|
|
186
|
+
fieldSchemaInfo.description += "\u9ED8\u8BA4\u65F6\u95F4\uFF1A".concat(defaultTime, " ");
|
|
211
187
|
}
|
|
188
|
+
var dateformat = componentElement.props.format || '';
|
|
189
|
+
if (!dateformat) {
|
|
190
|
+
switch (componentElement.props.type) {
|
|
191
|
+
case 'date':
|
|
192
|
+
dateformat = 'YYYY-MM-DD';
|
|
193
|
+
break;
|
|
194
|
+
case 'time':
|
|
195
|
+
dateformat = 'HH:mm:ss';
|
|
196
|
+
break;
|
|
197
|
+
case 'datetime':
|
|
198
|
+
dateformat = 'YYYY-MM-DD HH:mm:ss';
|
|
199
|
+
break;
|
|
200
|
+
case 'week':
|
|
201
|
+
dateformat = 'GGGG WW';
|
|
202
|
+
break;
|
|
203
|
+
case 'month':
|
|
204
|
+
dateformat = 'YYYY-MM';
|
|
205
|
+
break;
|
|
206
|
+
case 'quarter':
|
|
207
|
+
dateformat = 'YYYY-[Q]Q';
|
|
208
|
+
break;
|
|
209
|
+
case 'year':
|
|
210
|
+
dateformat = 'YYYY';
|
|
211
|
+
break;
|
|
212
|
+
default:
|
|
213
|
+
dateformat = 'YYYY-MM-DD';
|
|
214
|
+
break;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
fieldSchemaInfo.description += "\u683C\u5F0F\uFF1A".concat(dateformat, " ");
|
|
218
|
+
if (componentElement.props.max) {
|
|
219
|
+
fieldSchemaInfo.description += "\u6700\u5927\u65F6\u95F4\uFF1A".concat(componentElement.props.max, " ");
|
|
220
|
+
}
|
|
221
|
+
if (componentElement.props.min) {
|
|
222
|
+
fieldSchemaInfo.description += "\u6700\u5C0F\u65F6\u95F4\uFF1A".concat(componentElement.props.min, " ");
|
|
223
|
+
}
|
|
224
|
+
break;
|
|
212
225
|
}
|
|
213
|
-
fieldSchemaInfo.description += "\u683C\u5F0F\uFF1A".concat(dateformat, " ");
|
|
214
|
-
if (componentElement.props.max) {
|
|
215
|
-
fieldSchemaInfo.description += "\u6700\u5927\u65F6\u95F4\uFF1A".concat(componentElement.props.max, " ");
|
|
216
|
-
}
|
|
217
|
-
if (componentElement.props.min) {
|
|
218
|
-
fieldSchemaInfo.description += "\u6700\u5C0F\u65F6\u95F4\uFF1A".concat(componentElement.props.min, " ");
|
|
219
|
-
}
|
|
220
|
-
break;
|
|
221
226
|
case 'ShineoutCheckbox':
|
|
222
227
|
case 'ShineoutCheckboxGroup':
|
|
223
228
|
{
|
|
@@ -383,7 +388,7 @@ var SchemaBuilder = exports.SchemaBuilder = /*#__PURE__*/function () {
|
|
|
383
388
|
}
|
|
384
389
|
|
|
385
390
|
// 过滤掉 required 属性,items 对象不应该包含 required
|
|
386
|
-
var
|
|
391
|
+
var _required = meta.required,
|
|
387
392
|
itemsMeta = _objectWithoutProperties(meta, _excluded);
|
|
388
393
|
this.mergeSchema(currentSchema.items, remainingSegments, itemsMeta);
|
|
389
394
|
}
|
|
@@ -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,CAAC,EAAE,GAAG,EAAE,CAAC;QAAC,KAAK,CAAC,EAAE,GAAG,EAAE,CAAA;KAAE,CAAC;IAChD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC5C,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAiB;gBACnB,QAAQ,EAAE,MAAM;IAQ5B,OAAO,CAA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E,GAAG,CAAC;IACX,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAiB;gBACnB,QAAQ,EAAE,MAAM;IAQ5B,OAAO,CAAC,WAAW;IAYnB,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;IAkPd,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;IAetG,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"}
|
|
@@ -8,6 +8,8 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
9
|
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
12
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
13
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
14
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
15
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
@@ -54,7 +56,6 @@ export var SchemaBuilder = /*#__PURE__*/function () {
|
|
|
54
56
|
}, {
|
|
55
57
|
key: "buildSchemaFromComponent",
|
|
56
58
|
value: function buildSchemaFromComponent(params) {
|
|
57
|
-
var _componentElement$pro;
|
|
58
59
|
var componentElement = params.componentElement,
|
|
59
60
|
rules = params.rules,
|
|
60
61
|
label = params.label,
|
|
@@ -153,65 +154,69 @@ export var SchemaBuilder = /*#__PURE__*/function () {
|
|
|
153
154
|
if (componentElement.props.data.length > 0) {
|
|
154
155
|
fieldSchemaInfo.description += "enumData: ".concat(JSON.stringify(componentElement.props.data), ";");
|
|
155
156
|
}
|
|
157
|
+
fieldSchemaInfo.props = _objectSpread({}, componentElement.props);
|
|
156
158
|
break;
|
|
157
159
|
}
|
|
158
160
|
case 'ShineoutDatePicker':
|
|
159
|
-
|
|
160
|
-
|
|
161
|
+
{
|
|
162
|
+
var _componentElement$pro;
|
|
163
|
+
if (componentElement.props.range) {
|
|
164
|
+
if (finalFieldId !== null && finalFieldId !== void 0 && finalFieldId.includes(separator || '')) {
|
|
165
|
+
fieldSchemaInfo.type = 'string';
|
|
166
|
+
fieldSchemaInfo.format = 'date';
|
|
167
|
+
} else {
|
|
168
|
+
fieldSchemaInfo.type = 'array';
|
|
169
|
+
fieldSchemaInfo.items = {
|
|
170
|
+
type: 'string',
|
|
171
|
+
format: 'date'
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
} else {
|
|
161
175
|
fieldSchemaInfo.type = 'string';
|
|
162
176
|
fieldSchemaInfo.format = 'date';
|
|
163
|
-
} else {
|
|
164
|
-
fieldSchemaInfo.type = 'array';
|
|
165
|
-
fieldSchemaInfo.items = {
|
|
166
|
-
type: 'string',
|
|
167
|
-
format: 'date'
|
|
168
|
-
};
|
|
169
177
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
}
|
|
174
|
-
var defaultTime = ((_componentElement$pro = componentElement.props.defaultTime) === null || _componentElement$pro === void 0 ? void 0 : _componentElement$pro.toString()) || '';
|
|
175
|
-
if (defaultTime) {
|
|
176
|
-
fieldSchemaInfo.description += "\u9ED8\u8BA4\u65F6\u95F4\uFF1A".concat(defaultTime, " ");
|
|
177
|
-
}
|
|
178
|
-
var dateformat = componentElement.props.format || '';
|
|
179
|
-
if (!dateformat) {
|
|
180
|
-
switch (componentElement.props.type) {
|
|
181
|
-
case 'date':
|
|
182
|
-
dateformat = 'YYYY-MM-DD';
|
|
183
|
-
break;
|
|
184
|
-
case 'time':
|
|
185
|
-
dateformat = 'HH:mm:ss';
|
|
186
|
-
break;
|
|
187
|
-
case 'datetime':
|
|
188
|
-
dateformat = 'YYYY-MM-DD HH:mm:ss';
|
|
189
|
-
break;
|
|
190
|
-
case 'week':
|
|
191
|
-
dateformat = 'GGGG WW';
|
|
192
|
-
break;
|
|
193
|
-
case 'month':
|
|
194
|
-
dateformat = 'YYYY-MM';
|
|
195
|
-
break;
|
|
196
|
-
case 'quarter':
|
|
197
|
-
dateformat = 'YYYY-\[Q]Q';
|
|
198
|
-
break;
|
|
199
|
-
case 'year':
|
|
200
|
-
dateformat = 'YYYY';
|
|
201
|
-
break;
|
|
202
|
-
default:
|
|
203
|
-
dateformat = 'YYYY-MM-DD';
|
|
204
|
-
break;
|
|
178
|
+
var defaultTime = ((_componentElement$pro = componentElement.props.defaultTime) === null || _componentElement$pro === void 0 ? void 0 : _componentElement$pro.toString()) || '';
|
|
179
|
+
if (defaultTime) {
|
|
180
|
+
fieldSchemaInfo.description += "\u9ED8\u8BA4\u65F6\u95F4\uFF1A".concat(defaultTime, " ");
|
|
205
181
|
}
|
|
182
|
+
var dateformat = componentElement.props.format || '';
|
|
183
|
+
if (!dateformat) {
|
|
184
|
+
switch (componentElement.props.type) {
|
|
185
|
+
case 'date':
|
|
186
|
+
dateformat = 'YYYY-MM-DD';
|
|
187
|
+
break;
|
|
188
|
+
case 'time':
|
|
189
|
+
dateformat = 'HH:mm:ss';
|
|
190
|
+
break;
|
|
191
|
+
case 'datetime':
|
|
192
|
+
dateformat = 'YYYY-MM-DD HH:mm:ss';
|
|
193
|
+
break;
|
|
194
|
+
case 'week':
|
|
195
|
+
dateformat = 'GGGG WW';
|
|
196
|
+
break;
|
|
197
|
+
case 'month':
|
|
198
|
+
dateformat = 'YYYY-MM';
|
|
199
|
+
break;
|
|
200
|
+
case 'quarter':
|
|
201
|
+
dateformat = 'YYYY-[Q]Q';
|
|
202
|
+
break;
|
|
203
|
+
case 'year':
|
|
204
|
+
dateformat = 'YYYY';
|
|
205
|
+
break;
|
|
206
|
+
default:
|
|
207
|
+
dateformat = 'YYYY-MM-DD';
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
fieldSchemaInfo.description += "\u683C\u5F0F\uFF1A".concat(dateformat, " ");
|
|
212
|
+
if (componentElement.props.max) {
|
|
213
|
+
fieldSchemaInfo.description += "\u6700\u5927\u65F6\u95F4\uFF1A".concat(componentElement.props.max, " ");
|
|
214
|
+
}
|
|
215
|
+
if (componentElement.props.min) {
|
|
216
|
+
fieldSchemaInfo.description += "\u6700\u5C0F\u65F6\u95F4\uFF1A".concat(componentElement.props.min, " ");
|
|
217
|
+
}
|
|
218
|
+
break;
|
|
206
219
|
}
|
|
207
|
-
fieldSchemaInfo.description += "\u683C\u5F0F\uFF1A".concat(dateformat, " ");
|
|
208
|
-
if (componentElement.props.max) {
|
|
209
|
-
fieldSchemaInfo.description += "\u6700\u5927\u65F6\u95F4\uFF1A".concat(componentElement.props.max, " ");
|
|
210
|
-
}
|
|
211
|
-
if (componentElement.props.min) {
|
|
212
|
-
fieldSchemaInfo.description += "\u6700\u5C0F\u65F6\u95F4\uFF1A".concat(componentElement.props.min, " ");
|
|
213
|
-
}
|
|
214
|
-
break;
|
|
215
220
|
case 'ShineoutCheckbox':
|
|
216
221
|
case 'ShineoutCheckboxGroup':
|
|
217
222
|
{
|
|
@@ -377,7 +382,7 @@ export var SchemaBuilder = /*#__PURE__*/function () {
|
|
|
377
382
|
}
|
|
378
383
|
|
|
379
384
|
// 过滤掉 required 属性,items 对象不应该包含 required
|
|
380
|
-
var
|
|
385
|
+
var _required = meta.required,
|
|
381
386
|
itemsMeta = _objectWithoutProperties(meta, _excluded);
|
|
382
387
|
this.mergeSchema(currentSchema.items, remainingSegments, itemsMeta);
|
|
383
388
|
}
|