adminizer 4.1.0-build.4 → 4.1.0-build.5

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.
@@ -77,7 +77,7 @@ export class ConfigHelper {
77
77
  }
78
78
  // Boolean notation: `true` means field is visible; `false` means field is hidden.
79
79
  if (typeof config === "boolean") {
80
- return config ? { title: key } : false;
80
+ return config ? { title: key } : { visible: false };
81
81
  }
82
82
  // String notation: Interpreted as the field title.
83
83
  if (typeof config === "string") {
@@ -86,6 +86,7 @@ export class ConfigHelper {
86
86
  // Object notation: Allows full customization of the field.
87
87
  if (typeof config === "object" && config !== null) {
88
88
  config.title = config.title || key;
89
+ config.visible = Boolean(config.visible);
89
90
  // For association types, determine display field by checking model attributes.
90
91
  if (["association", "association-many"].includes(config.type)) {
91
92
  let associatedModelAttributes = {};
@@ -25,6 +25,8 @@ export default function inertiaAddHelper(req, entity, fields, record, view = fal
25
25
  continue;
26
26
  let field = fields[key];
27
27
  let fieldConfig = field.config;
28
+ if (fieldConfig.visible === false)
29
+ continue;
28
30
  const type = (fieldConfig.type || fieldConfig.type).toLowerCase();
29
31
  //@ts-ignore TODO: fix model validations
30
32
  const isIn = typeof fieldConfig.isIn === 'object' ? fieldConfig.isIn : (field.model && typeof { ...field.model.validations }.isIn === 'object' ? { ...field.model.validations }.isIn : []);
@@ -9,6 +9,8 @@ export default function inertiaFormHelper(req, postLink, formData) {
9
9
  };
10
10
  for (const key of Object.keys(formData)) {
11
11
  let field = formData[key];
12
+ if (field.visible === false)
13
+ continue;
12
14
  const type = (field.type || field.type).toLowerCase();
13
15
  const isIn = field.isIn ?? [];
14
16
  let label = field.title ?? '';
@@ -316,6 +316,8 @@ export interface BaseFieldConfig {
316
316
  disabled?: boolean;
317
317
  /** Show as required element HTML */
318
318
  required?: boolean;
319
+ /** show or hode element */
320
+ visible?: boolean;
319
321
  }
320
322
  export interface TuiEditorFieldConfig extends BaseFieldConfig {
321
323
  type: 'tui' | 'tuieditor' | 'toast-ui';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "adminizer",
3
3
  "type": "module",
4
- "version": "4.1.0-build.4",
4
+ "version": "4.1.0-build.5",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -44,6 +44,7 @@
44
44
  "sharp": "^0.33.5",
45
45
  "typeorm": "^0.3.20",
46
46
  "uuid": "^11.0.5",
47
+ "waterline": "^0.15.2",
47
48
  "winston": "^3.17.0"
48
49
  },
49
50
  "devDependencies": {
@@ -117,7 +118,6 @@
117
118
  "vite": "^6.1.0",
118
119
  "vite-plugin-externals": "^0.6.2",
119
120
  "vite-plugin-full-reload": "^1.2.0",
120
- "waterline": "^0.15.2",
121
121
  "sqlite3": "^5.1.7",
122
122
  "sequelize": "^6.37.5",
123
123
  "sequelize-typescript": "^2.1.6"