szld-libs 0.4.10 → 0.4.11

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.
@@ -257,10 +257,11 @@ function useDynamicForm(props) {
257
257
  formListField,
258
258
  isShowLabel = true
259
259
  }) => {
260
- var _a, _b, _c, _d, _e;
260
+ var _a, _b, _c, _d, _e, _f;
261
261
  if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true || (hideAttrList == null ? void 0 : hideAttrList.includes(itemWithJson.attrid))) {
262
262
  return /* @__PURE__ */ jsx(Fragment$1, {});
263
263
  }
264
+ readonly = ((_b = itemWithJson.json) == null ? void 0 : _b.readonly) || readonly || false;
264
265
  if (itemWithJson.attrtype === 1) {
265
266
  return renderNestedFormList({
266
267
  itemWithJson,
@@ -281,12 +282,12 @@ function useDynamicForm(props) {
281
282
  }
282
283
  if (itemWithJson.attrtype === 0) {
283
284
  const initialValue = handleSetFormItemInitialValue(itemWithJson);
284
- const message2 = (_b = itemWithJson.json) == null ? void 0 : _b["default-prompt"];
285
+ const message2 = (_c = itemWithJson.json) == null ? void 0 : _c["default-prompt"];
285
286
  const placeholder = handleGetPlaceholder(itemWithJson, langId);
286
287
  const { combinations = [] } = itemWithJson.json || {};
287
288
  if (combinations == null ? void 0 : combinations.length) {
288
289
  return /* @__PURE__ */ jsx(Flex, { children: combinations.map((item, index) => {
289
- var _a2, _b2, _c2, _d2, _e2, _f, _g;
290
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g;
290
291
  let initValue = handleSetFormItemInitialValue(item);
291
292
  let width = defaultWidth;
292
293
  const mode = item.json.input || "text";
@@ -301,7 +302,11 @@ function useDynamicForm(props) {
301
302
  return /* @__PURE__ */ jsx(
302
303
  Form.Item,
303
304
  {
304
- style: { flex: width },
305
+ style: {
306
+ flex: width,
307
+ pointerEvents: readonly ? "none" : "auto",
308
+ opacity: readonly ? 0.5 : 1
309
+ },
305
310
  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"] }),
306
311
  required: index === 0 ? (_d2 = item.json) == null ? void 0 : _d2.must : false,
307
312
  name: formListField ? Array.isArray(formListField.name) ? [...formListField.name, item.attrid] : [formListField.name, item.attrid] : item.attrid,
@@ -313,7 +318,7 @@ function useDynamicForm(props) {
313
318
  message: message2 || `${placeholder}${item.attrname}`
314
319
  }
315
320
  ] : [],
316
- ...((_f = itemWithJson.json) == null ? void 0 : _f.regexp) ? [
321
+ ...((_f2 = itemWithJson.json) == null ? void 0 : _f2.regexp) ? [
317
322
  {
318
323
  pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
319
324
  message: ((_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
@@ -344,22 +349,21 @@ function useDynamicForm(props) {
344
349
  name: formItemName,
345
350
  label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
346
351
  initialValue,
347
- disabled: readonly,
348
352
  style: {
349
353
  pointerEvents: readonly ? "none" : "auto",
350
354
  opacity: readonly ? 0.5 : 1
351
355
  },
352
356
  rules: [
353
- ...((_c = itemWithJson.json) == null ? void 0 : _c.must) ? [
357
+ ...((_d = itemWithJson.json) == null ? void 0 : _d.must) ? [
354
358
  {
355
359
  required: true,
356
360
  message: `${placeholder}${itemWithJson.attrname}`
357
361
  }
358
362
  ] : [],
359
- ...((_d = itemWithJson.json) == null ? void 0 : _d.regexp) ? [
363
+ ...((_e = itemWithJson.json) == null ? void 0 : _e.regexp) ? [
360
364
  {
361
365
  pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
362
- message: ((_e = itemWithJson.json) == null ? void 0 : _e["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
366
+ message: ((_f = itemWithJson.json) == null ? void 0 : _f["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
363
367
  }
364
368
  ] : []
365
369
  ],
package/es/mock/index.js CHANGED
@@ -8,7 +8,7 @@ const attrList = [
8
8
  attrid: "30BDE6E7977E40069B55DDE61C8795AE",
9
9
  attrname: "Dates",
10
10
  attrtype: 0,
11
- info: '{"input":"range-picker","range-picker-save":"single","dataType":"string","length":1000,"input-width":240,"must":true}',
11
+ info: '{"readonly":true,"input":"range-picker","range-picker-save":"single","dataType":"string","length":1000,"input-width":240,"must":true}',
12
12
  info_base64: 0,
13
13
  createtime: "2026-02-11 15:12:26",
14
14
  attrvalue: "",
@@ -258,10 +258,11 @@ function useDynamicForm(props) {
258
258
  formListField,
259
259
  isShowLabel = true
260
260
  }) => {
261
- var _a, _b, _c, _d, _e;
261
+ var _a, _b, _c, _d, _e, _f;
262
262
  if (((_a = itemWithJson.json) == null ? void 0 : _a.hide) === true || (hideAttrList == null ? void 0 : hideAttrList.includes(itemWithJson.attrid))) {
263
263
  return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {});
264
264
  }
265
+ readonly = ((_b = itemWithJson.json) == null ? void 0 : _b.readonly) || readonly || false;
265
266
  if (itemWithJson.attrtype === 1) {
266
267
  return renderNestedFormList({
267
268
  itemWithJson,
@@ -282,12 +283,12 @@ function useDynamicForm(props) {
282
283
  }
283
284
  if (itemWithJson.attrtype === 0) {
284
285
  const initialValue = func.handleSetFormItemInitialValue(itemWithJson);
285
- const message2 = (_b = itemWithJson.json) == null ? void 0 : _b["default-prompt"];
286
+ const message2 = (_c = itemWithJson.json) == null ? void 0 : _c["default-prompt"];
286
287
  const placeholder = func.handleGetPlaceholder(itemWithJson, langId);
287
288
  const { combinations = [] } = itemWithJson.json || {};
288
289
  if (combinations == null ? void 0 : combinations.length) {
289
290
  return /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { children: combinations.map((item, index) => {
290
- var _a2, _b2, _c2, _d2, _e2, _f, _g;
291
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g;
291
292
  let initValue = func.handleSetFormItemInitialValue(item);
292
293
  let width = defaultWidth;
293
294
  const mode = item.json.input || "text";
@@ -302,7 +303,11 @@ function useDynamicForm(props) {
302
303
  return /* @__PURE__ */ jsxRuntime.jsx(
303
304
  reactVant.Form.Item,
304
305
  {
305
- style: { flex: width },
306
+ style: {
307
+ flex: width,
308
+ pointerEvents: readonly ? "none" : "auto",
309
+ opacity: readonly ? 0.5 : 1
310
+ },
306
311
  label: index === 0 ? (_b2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _b2["combination-name"] : /* @__PURE__ */ jsxRuntime.jsx("div", { style: { visibility: "hidden" }, children: (_c2 = itemWithJson == null ? void 0 : itemWithJson.json) == null ? void 0 : _c2["combination-name"] }),
307
312
  required: index === 0 ? (_d2 = item.json) == null ? void 0 : _d2.must : false,
308
313
  name: formListField ? Array.isArray(formListField.name) ? [...formListField.name, item.attrid] : [formListField.name, item.attrid] : item.attrid,
@@ -314,7 +319,7 @@ function useDynamicForm(props) {
314
319
  message: message2 || `${placeholder}${item.attrname}`
315
320
  }
316
321
  ] : [],
317
- ...((_f = itemWithJson.json) == null ? void 0 : _f.regexp) ? [
322
+ ...((_f2 = itemWithJson.json) == null ? void 0 : _f2.regexp) ? [
318
323
  {
319
324
  pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
320
325
  message: ((_g = itemWithJson.json) == null ? void 0 : _g["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
@@ -345,22 +350,21 @@ function useDynamicForm(props) {
345
350
  name: formItemName,
346
351
  label: isShowLabel && handleDealInstruction(itemWithJson, instructionShowMode) || null,
347
352
  initialValue,
348
- disabled: readonly,
349
353
  style: {
350
354
  pointerEvents: readonly ? "none" : "auto",
351
355
  opacity: readonly ? 0.5 : 1
352
356
  },
353
357
  rules: [
354
- ...((_c = itemWithJson.json) == null ? void 0 : _c.must) ? [
358
+ ...((_d = itemWithJson.json) == null ? void 0 : _d.must) ? [
355
359
  {
356
360
  required: true,
357
361
  message: `${placeholder}${itemWithJson.attrname}`
358
362
  }
359
363
  ] : [],
360
- ...((_d = itemWithJson.json) == null ? void 0 : _d.regexp) ? [
364
+ ...((_e = itemWithJson.json) == null ? void 0 : _e.regexp) ? [
361
365
  {
362
366
  pattern: new RegExp(itemWithJson.json.regexp.replace(/^\/|\/$/g, "")),
363
- message: ((_e = itemWithJson.json) == null ? void 0 : _e["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
367
+ message: ((_f = itemWithJson.json) == null ? void 0 : _f["regexp-message"]) || `${itemWithJson.attrname}格式不正确`
364
368
  }
365
369
  ] : []
366
370
  ],
package/lib/mock/index.js CHANGED
@@ -10,7 +10,7 @@ const attrList = [
10
10
  attrid: "30BDE6E7977E40069B55DDE61C8795AE",
11
11
  attrname: "Dates",
12
12
  attrtype: 0,
13
- info: '{"input":"range-picker","range-picker-save":"single","dataType":"string","length":1000,"input-width":240,"must":true}',
13
+ info: '{"readonly":true,"input":"range-picker","range-picker-save":"single","dataType":"string","length":1000,"input-width":240,"must":true}',
14
14
  info_base64: 0,
15
15
  createtime: "2026-02-11 15:12:26",
16
16
  attrvalue: "",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "szld-libs",
3
3
  "private": false,
4
- "version": "0.4.10",
4
+ "version": "0.4.11",
5
5
  "type": "module",
6
6
  "scripts": {
7
7
  "dev": "vite",