@gisce/react-ooui 2.91.0 → 2.92.1

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/README.md CHANGED
@@ -51,3 +51,4 @@ You can browse our Storybook running:
51
51
 
52
52
  - `npm install`
53
53
  - `npm run storybook`
54
+
@@ -1 +1 @@
1
- {"version":3,"file":"usePermissions.d.ts","sourceRoot":"","sources":["../../src/hooks/usePermissions.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAE7D,eAAO,MAAM,cAAc;8BAcd,MAAM,eACA,cAAc,EAAE,KAC5B,QAAQ,cAAc,CAAC;;CA8B7B,CAAC;AACF,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,EAAE,cAAc,GAAG,IAAI,CAAC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,mBAAmB,qCAI7B,0BAA0B,KAAG,yBAsD/B,CAAC"}
1
+ {"version":3,"file":"usePermissions.d.ts","sourceRoot":"","sources":["../../src/hooks/usePermissions.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEpE,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;AAE7D,eAAO,MAAM,cAAc;8BAcd,MAAM,eACA,cAAc,EAAE,KAC5B,QAAQ,cAAc,CAAC;;CA+B7B,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,EAAE,cAAc,GAAG,IAAI,CAAC;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,cAAc,EAAE,CAAC;IAC9B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,mBAAmB,qCAI7B,0BAA0B,KAAG,yBAsD/B,CAAC"}
@@ -7,7 +7,8 @@ export declare enum ErpFeatureKeys {
7
7
  FEATURE_GET_TOOLBAR = "get_toolbar",
8
8
  FEATURE_MANY2ONE_SORT = "many2one_sort",
9
9
  FEATURE_LOGGABLE_ACTIONS = "user_action_logs",
10
- FEATURE_USER_FLAGS = "user_feature_flags"
10
+ FEATURE_USER_FLAGS = "user_feature_flags",
11
+ FEATURE_CHECK_PERMS = "check_perms"
11
12
  }
12
13
  export declare const ErpAllFeatureKeys: string[];
13
14
  export interface ErpFeatureState {
@@ -1 +1 @@
1
- {"version":3,"file":"erpFeature.d.ts","sourceRoot":"","sources":["../../src/models/erpFeature.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,uBAAuB,oBAAoB;IAC3C,uBAAuB,iBAAiB;IACxC,kBAAkB,eAAe;IACjC,mBAAmB,kBAAkB;IACrC,qBAAqB,oBAAoB;IACzC,mBAAmB,gBAAgB;IACnC,qBAAqB,kBAAkB;IACvC,wBAAwB,qBAAqB;IAC7C,kBAAkB,uBAAuB;CAE1C;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,EAAkC,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,MAAM,cAAc,GAAG;KAC1B,GAAG,IAAI,cAAc,CAAC,CAAC,EAAE,eAAe;CAC1C,CAAC"}
1
+ {"version":3,"file":"erpFeature.d.ts","sourceRoot":"","sources":["../../src/models/erpFeature.ts"],"names":[],"mappings":"AAAA,oBAAY,cAAc;IACxB,uBAAuB,oBAAoB;IAC3C,uBAAuB,iBAAiB;IACxC,kBAAkB,eAAe;IACjC,mBAAmB,kBAAkB;IACrC,qBAAqB,oBAAoB;IACzC,mBAAmB,gBAAgB;IACnC,qBAAqB,kBAAkB;IACvC,wBAAwB,qBAAqB;IAC7C,kBAAkB,uBAAuB;IACzC,mBAAmB,gBAAgB;CAEpC;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,EAAkC,CAAC;AAEzE,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACjC;AAED,MAAM,MAAM,cAAc,GAAG;KAC1B,GAAG,IAAI,cAAc,CAAC,CAAC,EAAE,eAAe;CAC1C,CAAC"}
@@ -3415,7 +3415,7 @@ function vf(e) {
3415
3415
  }
3416
3416
  );
3417
3417
  }
3418
- var Dt = /* @__PURE__ */ ((e) => (e.FEATURE_VIEW_JSON_ATTRS = "view_json_attrs", e.FEATURE_ADVANCED_EXPORT = "export_data2", e.FEATURE_OMNISEARCH = "omnisearch", e.FEATURE_READFORVIEW = "read_for_view", e.FEATURE_USERVIEWPREFS = "user_view_prefs", e.FEATURE_GET_TOOLBAR = "get_toolbar", e.FEATURE_MANY2ONE_SORT = "many2one_sort", e.FEATURE_LOGGABLE_ACTIONS = "user_action_logs", e.FEATURE_USER_FLAGS = "user_feature_flags", e))(Dt || {});
3418
+ var Dt = /* @__PURE__ */ ((e) => (e.FEATURE_VIEW_JSON_ATTRS = "view_json_attrs", e.FEATURE_ADVANCED_EXPORT = "export_data2", e.FEATURE_OMNISEARCH = "omnisearch", e.FEATURE_READFORVIEW = "read_for_view", e.FEATURE_USERVIEWPREFS = "user_view_prefs", e.FEATURE_GET_TOOLBAR = "get_toolbar", e.FEATURE_MANY2ONE_SORT = "many2one_sort", e.FEATURE_LOGGABLE_ACTIONS = "user_action_logs", e.FEATURE_USER_FLAGS = "user_feature_flags", e.FEATURE_CHECK_PERMS = "check_perms", e))(Dt || {});
3419
3419
  const cw = Object.values(Dt), Vt = tn.createContext(null), bf = (e) => {
3420
3420
  const {
3421
3421
  children: t,
@@ -11720,16 +11720,18 @@ const Bn = Nt(ey), Un = (e) => {
11720
11720
  }, []), { checkPermissions: E(
11721
11721
  async (r, o) => {
11722
11722
  try {
11723
- const i = o.map(async (c) => {
11724
- const d = await e({
11725
- model: r,
11726
- type: c
11727
- });
11728
- return { permission: c, hasPermission: d };
11729
- }), a = await Promise.all(i), l = {};
11730
- return a.forEach(({ permission: c, hasPermission: d }) => {
11731
- l[c] = d;
11732
- }), l;
11723
+ const i = await e({
11724
+ model: r,
11725
+ type: o
11726
+ });
11727
+ if (typeof i == "boolean") {
11728
+ const l = {};
11729
+ return l[o[0]] = i, l;
11730
+ }
11731
+ const a = {};
11732
+ return o.forEach((l) => {
11733
+ a[l] = i[l] || !1;
11734
+ }), a;
11733
11735
  } catch (i) {
11734
11736
  throw console.error("Error checking permissions:", i), i;
11735
11737
  }