@luomus/laji-form 15.1.44 → 15.1.45

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.
@@ -22,10 +22,10 @@ exports.rulePropType = PropTypes.oneOfType([
22
22
  complement: PropTypes.bool
23
23
  }),
24
24
  PropTypes.shape({
25
- rule: PropTypes.oneOf(["isAdmin", "isEdit"]),
25
+ rule: PropTypes.oneOf(["isAdmin", "isEdit", "isReadonly"]),
26
26
  complement: PropTypes.bool
27
27
  }),
28
- PropTypes.oneOf(["isAdmin", "isEdit"])
28
+ PropTypes.oneOf(["isAdmin", "isEdit", "isReadonly"]),
29
29
  ]);
30
30
  exports.operationPropType = PropTypes.shape({
31
31
  type: PropTypes.oneOf(["merge", "wrap"]),
package/lib/utils.js CHANGED
@@ -776,11 +776,8 @@ function checkRules(rules, props, cache, prop = "formData") {
776
776
  const passes = (Array.isArray(rules) ? rules : [rules]).every((rule, idx) => {
777
777
  let passes;
778
778
  // BW compatibility for old string rule
779
- if (rule === "isAdmin") {
780
- rule = { rule: "isAdmin" };
781
- }
782
- else if (rule === "isEdit") {
783
- rule = { rule: "isEdit" };
779
+ if (["isAdmin", "isEdit", "isReadonly"].includes(rule)) {
780
+ rule = { rule };
784
781
  }
785
782
  const { field, regexp, valueIn, valueIncludes, valueLengthLessThan, rule: _rule } = rule;
786
783
  if (_rule) {
@@ -790,6 +787,9 @@ function checkRules(rules, props, cache, prop = "formData") {
790
787
  else if (_rule === "isEdit") {
791
788
  passes = props.formContext.uiSchemaContext.isEdit;
792
789
  }
790
+ else if (_rule === "isReadonly") {
791
+ passes = props.readonly;
792
+ }
793
793
  }
794
794
  else {
795
795
  let value = parseJSONPointer(props[prop] || {}, field);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luomus/laji-form",
3
- "version": "15.1.44",
3
+ "version": "15.1.45",
4
4
  "description": "React module capable of building dynamic forms from Laji form json schemas",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -24,6 +24,7 @@
24
24
  "prepublishOnly": "npm run build && git push && git push --tags",
25
25
  "lint": "eslint -c .eslintrc.prod.json src playground",
26
26
  "test": "npx playwright test",
27
+ "test:ui": "npx playwright test --ui",
27
28
  "test:docker": "npm run test:docker:build && npm run test:docker:run --",
28
29
  "test:lightweight": "npx playwright test --project chromium",
29
30
  "test:docker:build": "docker build -t laji-form-test -f test.Dockerfile .",
@@ -232,6 +232,10 @@ export declare class DemoPageForm extends Form {
232
232
  getState(): Promise<{
233
233
  formData: any;
234
234
  }>;
235
+ getProps(): Promise<{
236
+ schema: any;
237
+ uiSchema: any;
238
+ }>;
235
239
  submit(): Promise<void>;
236
240
  startSubmit(): void;
237
241
  submitOnlySchemaValidations(): Promise<any>;
@@ -302,6 +302,12 @@ class DemoPageForm extends Form {
302
302
  return { formData };
303
303
  });
304
304
  }
305
+ getProps() {
306
+ return this.page.evaluate(() => {
307
+ const { schema, uiSchema } = window.lajiForm.lajiForm.props;
308
+ return { schema, uiSchema };
309
+ });
310
+ }
305
311
  submit() {
306
312
  return __awaiter(this, void 0, void 0, function* () {
307
313
  yield this.e("submit()");