szld-libs 0.4.35 → 0.4.37
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/dist/szld-components.es.js +2357 -2351
- package/dist/szld-components.umd.js +33 -33
- package/es/components/DynamicForm/mySelect/index.js +1 -0
- package/es/components/DynamicForm/useDynamicForm.js +10 -8
- package/es/components/DynamicFormMobile/useDynamicForm.js +15 -12
- package/es/mock/index.js +550 -40
- package/es/utils/method.d.ts +1 -0
- package/lib/components/DynamicForm/mySelect/index.js +1 -0
- package/lib/components/DynamicForm/useDynamicForm.js +10 -8
- package/lib/components/DynamicFormMobile/useDynamicForm.js +15 -12
- package/lib/mock/index.js +550 -40
- package/lib/utils/method.d.ts +1 -0
- package/package.json +1 -1
|
@@ -91,6 +91,7 @@ const MySelect = ({
|
|
|
91
91
|
},
|
|
92
92
|
options,
|
|
93
93
|
style: { ...style },
|
|
94
|
+
maxTagCount: 1,
|
|
94
95
|
allowClear: true,
|
|
95
96
|
onChange: (val) => {
|
|
96
97
|
if (attrid && (instanceList == null ? void 0 : instanceList.length) > 0 && (item == null ? void 0 : item.inputType) === "instance-url") {
|
|
@@ -192,7 +192,9 @@ function useDynamicForm(props) {
|
|
|
192
192
|
parentFormListField,
|
|
193
193
|
isShowLabel = true
|
|
194
194
|
}) => {
|
|
195
|
+
var _a;
|
|
195
196
|
const formListInitValue = handleSetFormItemInitialValue(itemWithJson);
|
|
197
|
+
const hidden = (_a = itemWithJson.json) == null ? void 0 : _a.hidden;
|
|
196
198
|
let children = itemWithJson.children || [];
|
|
197
199
|
if (Array.isArray(children == null ? void 0 : children[0]) && children.length) {
|
|
198
200
|
children = children[0];
|
|
@@ -204,7 +206,7 @@ function useDynamicForm(props) {
|
|
|
204
206
|
}
|
|
205
207
|
return [itemWithJson.attrid, field.name];
|
|
206
208
|
};
|
|
207
|
-
return /* @__PURE__ */ jsx(Col, { span: 24 / colNum, children: /* @__PURE__ */ jsx(
|
|
209
|
+
return /* @__PURE__ */ jsx(Col, { span: hidden ? 0 : 24 / colNum, children: /* @__PURE__ */ jsx(
|
|
208
210
|
Collapse,
|
|
209
211
|
{
|
|
210
212
|
bordered: false,
|
|
@@ -299,10 +301,11 @@ function useDynamicForm(props) {
|
|
|
299
301
|
isShowLabel = true
|
|
300
302
|
}) => {
|
|
301
303
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
302
|
-
|
|
304
|
+
const hidden = (_a = itemWithJson.json) == null ? void 0 : _a.hidden;
|
|
305
|
+
if (((_b = itemWithJson.json) == null ? void 0 : _b.hide) === true) {
|
|
303
306
|
return /* @__PURE__ */ jsx(Fragment$1, {});
|
|
304
307
|
}
|
|
305
|
-
if (itemWithJson.attrtype === 1) {
|
|
308
|
+
if (itemWithJson.attrtype === 1 && !hidden) {
|
|
306
309
|
return renderNestedFormList({
|
|
307
310
|
itemWithJson,
|
|
308
311
|
colNum,
|
|
@@ -322,12 +325,11 @@ function useDynamicForm(props) {
|
|
|
322
325
|
}
|
|
323
326
|
if (itemWithJson.attrtype === 0) {
|
|
324
327
|
const initialValue = handleSetFormItemInitialValue(itemWithJson);
|
|
325
|
-
const message2 = (
|
|
326
|
-
const hidden = (_c = itemWithJson.json) == null ? void 0 : _c.hidden;
|
|
328
|
+
const message2 = (_c = itemWithJson.json) == null ? void 0 : _c["default-prompt"];
|
|
327
329
|
const placeholder = handleGetPlaceholder(itemWithJson, langId);
|
|
328
330
|
const { combinations = [] } = itemWithJson.json || {};
|
|
329
331
|
if (combinations == null ? void 0 : combinations.length) {
|
|
330
|
-
return /* @__PURE__ */ jsx(Col, { span: 24 / colNum, children: /* @__PURE__ */ jsx(
|
|
332
|
+
return /* @__PURE__ */ jsx(Col, { span: hidden ? 0 : 24 / colNum, children: /* @__PURE__ */ jsx(
|
|
331
333
|
Form.Item,
|
|
332
334
|
{
|
|
333
335
|
label: (_d = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _d["combination-name"],
|
|
@@ -390,7 +392,7 @@ function useDynamicForm(props) {
|
|
|
390
392
|
) });
|
|
391
393
|
}
|
|
392
394
|
const formItemName = isFormListItem && formListField ? Array.isArray(formListField.name) ? [...formListField.name, itemWithJson.attrid] : [formListField.name, itemWithJson.attrid] : itemWithJson.attrid;
|
|
393
|
-
return /* @__PURE__ */ jsx(Col, { span: 24 / colNum, children: /* @__PURE__ */ jsx(
|
|
395
|
+
return /* @__PURE__ */ jsx(Col, { span: hidden ? 0 : 24 / colNum, children: /* @__PURE__ */ jsx(
|
|
394
396
|
Form.Item,
|
|
395
397
|
{
|
|
396
398
|
name: formItemName,
|
|
@@ -652,7 +654,7 @@ function useDynamicForm(props) {
|
|
|
652
654
|
DatePicker,
|
|
653
655
|
{
|
|
654
656
|
multiple: true,
|
|
655
|
-
maxTagCount: ((_p = item == null ? void 0 : item.json) == null ? void 0 : _p["max-tag-count"]) ||
|
|
657
|
+
maxTagCount: ((_p = item == null ? void 0 : item.json) == null ? void 0 : _p["max-tag-count"]) || 1,
|
|
656
658
|
disabled: readonly || ((_q = item.json) == null ? void 0 : _q.readonly) || false,
|
|
657
659
|
style: { width, ...itemStyle == null ? void 0 : itemStyle.style, ...customWidth }
|
|
658
660
|
}
|
|
@@ -253,12 +253,13 @@ function useDynamicForm(props) {
|
|
|
253
253
|
formListField,
|
|
254
254
|
isShowLabel = true
|
|
255
255
|
}) => {
|
|
256
|
-
var _a, _b, _c, _d, _e, _f;
|
|
257
|
-
|
|
256
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
257
|
+
const hidden = (_a = itemWithJson.json) == null ? void 0 : _a.hidden;
|
|
258
|
+
if (((_b = itemWithJson.json) == null ? void 0 : _b.hide) === true || (hideAttrList == null ? void 0 : hideAttrList.includes(itemWithJson.attrid))) {
|
|
258
259
|
return /* @__PURE__ */ jsx(Fragment$1, {});
|
|
259
260
|
}
|
|
260
|
-
readonly = ((
|
|
261
|
-
if (itemWithJson.attrtype === 1) {
|
|
261
|
+
readonly = ((_c = itemWithJson.json) == null ? void 0 : _c.readonly) || readonly || false;
|
|
262
|
+
if (itemWithJson.attrtype === 1 && !hidden) {
|
|
262
263
|
return renderNestedFormList({
|
|
263
264
|
itemWithJson,
|
|
264
265
|
colNum,
|
|
@@ -278,12 +279,12 @@ function useDynamicForm(props) {
|
|
|
278
279
|
}
|
|
279
280
|
if (itemWithJson.attrtype === 0) {
|
|
280
281
|
const initialValue = handleSetFormItemInitialValue(itemWithJson);
|
|
281
|
-
const message2 = (
|
|
282
|
+
const message2 = (_d = itemWithJson.json) == null ? void 0 : _d["default-prompt"];
|
|
282
283
|
const placeholder = handleGetPlaceholder(itemWithJson, langId);
|
|
283
284
|
const { combinations = [] } = itemWithJson.json || {};
|
|
284
285
|
if (combinations == null ? void 0 : combinations.length) {
|
|
285
286
|
return /* @__PURE__ */ jsx(Flex, { children: combinations.map((item, index) => {
|
|
286
|
-
var _a2, _b2, _c2, _d2, _e2, _f2,
|
|
287
|
+
var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
|
|
287
288
|
let initValue = handleSetFormItemInitialValue(item);
|
|
288
289
|
let width = defaultWidth;
|
|
289
290
|
const mode = item.json.input || "text";
|
|
@@ -301,7 +302,8 @@ function useDynamicForm(props) {
|
|
|
301
302
|
style: {
|
|
302
303
|
flex: width,
|
|
303
304
|
pointerEvents: readonly ? "none" : "auto",
|
|
304
|
-
opacity: readonly ? 0.5 : 1
|
|
305
|
+
opacity: readonly ? 0.5 : 1,
|
|
306
|
+
display: hidden ? "none" : "block"
|
|
305
307
|
},
|
|
306
308
|
label: index === 0 ? (_b2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b2["combination-name"] : /* @__PURE__ */ jsx("div", { style: { visibility: "hidden" }, children: (_c2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c2["combination-name"] }),
|
|
307
309
|
required: index === 0 ? (_d2 = item.json) == null ? void 0 : _d2.must : false,
|
|
@@ -317,7 +319,7 @@ function useDynamicForm(props) {
|
|
|
317
319
|
...((_f2 = itemWithJson.json) == null ? void 0 : _f2.regexp) ? [
|
|
318
320
|
{
|
|
319
321
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
320
|
-
message: ((
|
|
322
|
+
message: ((_g2 = itemWithJson.json) == null ? void 0 : _g2["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
|
|
321
323
|
}
|
|
322
324
|
] : []
|
|
323
325
|
],
|
|
@@ -348,19 +350,20 @@ function useDynamicForm(props) {
|
|
|
348
350
|
initialValue,
|
|
349
351
|
style: {
|
|
350
352
|
pointerEvents: readonly ? "none" : "auto",
|
|
351
|
-
opacity: readonly ? 0.5 : 1
|
|
353
|
+
opacity: readonly ? 0.5 : 1,
|
|
354
|
+
display: hidden ? "none" : "block"
|
|
352
355
|
},
|
|
353
356
|
rules: [
|
|
354
|
-
...((
|
|
357
|
+
...((_e = itemWithJson.json) == null ? void 0 : _e.must) ? [
|
|
355
358
|
{
|
|
356
359
|
required: true,
|
|
357
360
|
message: `${placeholder}${itemWithJson.attrname}`
|
|
358
361
|
}
|
|
359
362
|
] : [],
|
|
360
|
-
...((
|
|
363
|
+
...((_f = itemWithJson.json) == null ? void 0 : _f.regexp) ? [
|
|
361
364
|
{
|
|
362
365
|
pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
|
|
363
|
-
message: ((
|
|
366
|
+
message: ((_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
|
|
364
367
|
}
|
|
365
368
|
] : []
|
|
366
369
|
],
|