@sankhyalabs/sankhyablocks 1.3.31-beta.6 → 1.3.32

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.
Files changed (72) hide show
  1. package/dist/cjs/{index-532bcc28.js → index-1133bc2a.js} +9 -419
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/sankhyablocks.cjs.js +2 -2
  4. package/dist/cjs/snk-application.cjs.entry.js +99 -213
  5. package/dist/cjs/snk-pesquisa.cjs.entry.js +6 -3
  6. package/dist/cjs/teste-pesquisa.cjs.entry.js +1 -1
  7. package/dist/collection/collection-manifest.json +0 -4
  8. package/dist/collection/components/snk-application/snk-application.js +48 -165
  9. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +49 -10
  10. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +5 -1
  11. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +21 -52
  12. package/dist/collection/lib/http/data-fetcher/fetchers/grid-config-fetcher.js +3 -4
  13. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +2 -0
  14. package/dist/components/snk-application2.js +98 -213
  15. package/dist/components/snk-pesquisa2.js +5 -2
  16. package/dist/esm/{index-0b078db7.js → index-ffda6382.js} +10 -419
  17. package/dist/esm/loader.js +2 -2
  18. package/dist/esm/sankhyablocks.js +2 -2
  19. package/dist/esm/snk-application.entry.js +99 -213
  20. package/dist/esm/snk-pesquisa.entry.js +6 -3
  21. package/dist/esm/teste-pesquisa.entry.js +1 -1
  22. package/dist/sankhyablocks/p-24238a55.entry.js +1 -0
  23. package/dist/sankhyablocks/{p-a8305c35.entry.js → p-2a7b4cb3.entry.js} +1 -1
  24. package/dist/sankhyablocks/p-bd1b31db.entry.js +69 -0
  25. package/dist/sankhyablocks/p-edcb9d8e.js +2 -0
  26. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  27. package/dist/types/components/snk-application/snk-application.d.ts +13 -90
  28. package/dist/types/components.d.ts +2 -334
  29. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +0 -2
  30. package/dist/types/lib/http/data-fetcher/fetchers/grid-config-fetcher.d.ts +1 -1
  31. package/package.json +5 -5
  32. package/react/components.d.ts +0 -4
  33. package/react/components.js +0 -4
  34. package/react/components.js.map +1 -1
  35. package/dist/cjs/snk-data-unit.cjs.entry.js +0 -189
  36. package/dist/cjs/snk-form.cjs.entry.js +0 -95
  37. package/dist/cjs/snk-grid.cjs.entry.js +0 -64
  38. package/dist/cjs/snk-taskbar.cjs.entry.js +0 -140
  39. package/dist/cjs/taskbar-elements-9d47b416.js +0 -70
  40. package/dist/collection/components/snk-data-unit/snk-data-unit.css +0 -6
  41. package/dist/collection/components/snk-data-unit/snk-data-unit.js +0 -449
  42. package/dist/collection/components/snk-form/snk-form.css +0 -3
  43. package/dist/collection/components/snk-form/snk-form.js +0 -194
  44. package/dist/collection/components/snk-grid/snk-grid.css +0 -5
  45. package/dist/collection/components/snk-grid/snk-grid.js +0 -128
  46. package/dist/collection/components/snk-taskbar/elements/taskbar-elements.js +0 -65
  47. package/dist/collection/components/snk-taskbar/snk-taskbar.css +0 -3
  48. package/dist/collection/components/snk-taskbar/snk-taskbar.js +0 -252
  49. package/dist/components/snk-data-unit.d.ts +0 -11
  50. package/dist/components/snk-data-unit.js +0 -213
  51. package/dist/components/snk-form.d.ts +0 -11
  52. package/dist/components/snk-form.js +0 -121
  53. package/dist/components/snk-grid.d.ts +0 -11
  54. package/dist/components/snk-grid.js +0 -88
  55. package/dist/components/snk-taskbar.d.ts +0 -11
  56. package/dist/components/snk-taskbar.js +0 -6
  57. package/dist/components/snk-taskbar2.js +0 -221
  58. package/dist/esm/snk-data-unit.entry.js +0 -185
  59. package/dist/esm/snk-form.entry.js +0 -91
  60. package/dist/esm/snk-grid.entry.js +0 -60
  61. package/dist/esm/snk-taskbar.entry.js +0 -136
  62. package/dist/esm/taskbar-elements-3ba30bf4.js +0 -68
  63. package/dist/sankhyablocks/p-3cb106f7.entry.js +0 -69
  64. package/dist/sankhyablocks/p-3fce3190.entry.js +0 -1
  65. package/dist/sankhyablocks/p-560fdf54.entry.js +0 -1
  66. package/dist/sankhyablocks/p-574764bf.js +0 -1
  67. package/dist/sankhyablocks/p-8f7b9a85.entry.js +0 -1
  68. package/dist/sankhyablocks/p-9c225717.entry.js +0 -1
  69. package/dist/sankhyablocks/p-a45dba1a.js +0 -2
  70. package/dist/sankhyablocks/p-a670853c.entry.js +0 -1
  71. package/dist/types/components/snk-taskbar/elements/taskbar-elements.d.ts +0 -25
  72. package/dist/types/components/snk-taskbar/snk-taskbar.d.ts +0 -45
@@ -2,9 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-532bcc28.js');
5
+ const index = require('./index-1133bc2a.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
  const utils = require('@sankhyalabs/ezui/dist/collection/utils');
8
+ const UnitMetadata = require('@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata');
8
9
 
9
10
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
10
11
 
@@ -1235,7 +1236,7 @@ function isNode(maybeNode) {
1235
1236
  }
1236
1237
  /** Name */
1237
1238
 
1238
- var OperationTypeNode;
1239
+ let OperationTypeNode;
1239
1240
  exports.OperationTypeNode = OperationTypeNode;
1240
1241
 
1241
1242
  (function (OperationTypeNode) {
@@ -1255,7 +1256,13 @@ exports.DirectiveLocation = void 0;
1255
1256
  /**
1256
1257
  * The set of allowed directive location values.
1257
1258
  */
1258
- var DirectiveLocation;
1259
+ let DirectiveLocation;
1260
+ /**
1261
+ * The enum type representing the directive location values.
1262
+ *
1263
+ * @deprecated Please use `DirectiveLocation`. Will be remove in v17.
1264
+ */
1265
+
1259
1266
  exports.DirectiveLocation = DirectiveLocation;
1260
1267
 
1261
1268
  (function (DirectiveLocation) {
@@ -1279,11 +1286,6 @@ exports.DirectiveLocation = DirectiveLocation;
1279
1286
  DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT';
1280
1287
  DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION';
1281
1288
  })(DirectiveLocation || (exports.DirectiveLocation = DirectiveLocation = {}));
1282
- /**
1283
- * The enum type representing the directive location values.
1284
- *
1285
- * @deprecated Please use `DirectiveLocation`. Will be remove in v17.
1286
- */
1287
1289
  });
1288
1290
 
1289
1291
  var kinds = createCommonjsModule(function (module, exports) {
@@ -1296,7 +1298,13 @@ exports.Kind = void 0;
1296
1298
  /**
1297
1299
  * The set of allowed kind values for AST nodes.
1298
1300
  */
1299
- var Kind;
1301
+ let Kind;
1302
+ /**
1303
+ * The enum type representing the possible kind values of AST nodes.
1304
+ *
1305
+ * @deprecated Please use `Kind`. Will be remove in v17.
1306
+ */
1307
+
1300
1308
  exports.Kind = Kind;
1301
1309
 
1302
1310
  (function (Kind) {
@@ -1344,11 +1352,6 @@ exports.Kind = Kind;
1344
1352
  Kind['ENUM_TYPE_EXTENSION'] = 'EnumTypeExtension';
1345
1353
  Kind['INPUT_OBJECT_TYPE_EXTENSION'] = 'InputObjectTypeExtension';
1346
1354
  })(Kind || (exports.Kind = Kind = {}));
1347
- /**
1348
- * The enum type representing the possible kind values of AST nodes.
1349
- *
1350
- * @deprecated Please use `Kind`. Will be remove in v17.
1351
- */
1352
1355
  });
1353
1356
 
1354
1357
  var characterClasses = createCommonjsModule(function (module, exports) {
@@ -1636,7 +1639,13 @@ exports.TokenKind = void 0;
1636
1639
  * An exported enum describing the different kinds of tokens that the
1637
1640
  * lexer emits.
1638
1641
  */
1639
- var TokenKind;
1642
+ let TokenKind;
1643
+ /**
1644
+ * The enum type representing the token kinds values.
1645
+ *
1646
+ * @deprecated Please use `TokenKind`. Will be remove in v17.
1647
+ */
1648
+
1640
1649
  exports.TokenKind = TokenKind;
1641
1650
 
1642
1651
  (function (TokenKind) {
@@ -1663,11 +1672,6 @@ exports.TokenKind = TokenKind;
1663
1672
  TokenKind['BLOCK_STRING'] = 'BlockString';
1664
1673
  TokenKind['COMMENT'] = 'Comment';
1665
1674
  })(TokenKind || (exports.TokenKind = TokenKind = {}));
1666
- /**
1667
- * The enum type representing the token kinds values.
1668
- *
1669
- * @deprecated Please use `TokenKind`. Will be remove in v17.
1670
- */
1671
1675
  });
1672
1676
 
1673
1677
  var lexer = createCommonjsModule(function (module, exports) {
@@ -3004,13 +3008,12 @@ function parseType(source, options) {
3004
3008
  */
3005
3009
 
3006
3010
  class Parser {
3007
- constructor(source$1, options = {}) {
3011
+ constructor(source$1, options) {
3008
3012
  const sourceObj = (0, source.isSource)(source$1)
3009
3013
  ? source$1
3010
3014
  : new source.Source(source$1);
3011
3015
  this._lexer = new lexer.Lexer(sourceObj);
3012
3016
  this._options = options;
3013
- this._tokenCounter = 0;
3014
3017
  }
3015
3018
  /**
3016
3019
  * Converts a name lex token into a name parse node.
@@ -3345,12 +3348,18 @@ class Parser {
3345
3348
  */
3346
3349
 
3347
3350
  parseFragmentDefinition() {
3351
+ var _this$_options;
3352
+
3348
3353
  const start = this._lexer.token;
3349
3354
  this.expectKeyword('fragment'); // Legacy support for defining variables within fragments changes
3350
3355
  // the grammar of FragmentDefinition:
3351
3356
  // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet
3352
3357
 
3353
- if (this._options.allowLegacyFragmentVariables === true) {
3358
+ if (
3359
+ ((_this$_options = this._options) === null || _this$_options === void 0
3360
+ ? void 0
3361
+ : _this$_options.allowLegacyFragmentVariables) === true
3362
+ ) {
3354
3363
  return this.node(start, {
3355
3364
  kind: kinds.Kind.FRAGMENT_DEFINITION,
3356
3365
  name: this.parseFragmentName(),
@@ -3411,14 +3420,16 @@ class Parser {
3411
3420
  return this.parseObject(isConst);
3412
3421
 
3413
3422
  case tokenKind.TokenKind.INT:
3414
- this.advanceLexer();
3423
+ this._lexer.advance();
3424
+
3415
3425
  return this.node(token, {
3416
3426
  kind: kinds.Kind.INT,
3417
3427
  value: token.value,
3418
3428
  });
3419
3429
 
3420
3430
  case tokenKind.TokenKind.FLOAT:
3421
- this.advanceLexer();
3431
+ this._lexer.advance();
3432
+
3422
3433
  return this.node(token, {
3423
3434
  kind: kinds.Kind.FLOAT,
3424
3435
  value: token.value,
@@ -3429,7 +3440,7 @@ class Parser {
3429
3440
  return this.parseStringLiteral();
3430
3441
 
3431
3442
  case tokenKind.TokenKind.NAME:
3432
- this.advanceLexer();
3443
+ this._lexer.advance();
3433
3444
 
3434
3445
  switch (token.value) {
3435
3446
  case 'true':
@@ -3485,7 +3496,9 @@ class Parser {
3485
3496
 
3486
3497
  parseStringLiteral() {
3487
3498
  const token = this._lexer.token;
3488
- this.advanceLexer();
3499
+
3500
+ this._lexer.advance();
3501
+
3489
3502
  return this.node(token, {
3490
3503
  kind: kinds.Kind.STRING,
3491
3504
  value: token.value,
@@ -4276,7 +4289,13 @@ class Parser {
4276
4289
  */
4277
4290
 
4278
4291
  node(startToken, node) {
4279
- if (this._options.noLocation !== true) {
4292
+ var _this$_options2;
4293
+
4294
+ if (
4295
+ ((_this$_options2 = this._options) === null || _this$_options2 === void 0
4296
+ ? void 0
4297
+ : _this$_options2.noLocation) !== true
4298
+ ) {
4280
4299
  node.loc = new ast.Location(
4281
4300
  startToken,
4282
4301
  this._lexer.lastToken,
@@ -4302,7 +4321,8 @@ class Parser {
4302
4321
  const token = this._lexer.token;
4303
4322
 
4304
4323
  if (token.kind === kind) {
4305
- this.advanceLexer();
4324
+ this._lexer.advance();
4325
+
4306
4326
  return token;
4307
4327
  }
4308
4328
 
@@ -4321,7 +4341,8 @@ class Parser {
4321
4341
  const token = this._lexer.token;
4322
4342
 
4323
4343
  if (token.kind === kind) {
4324
- this.advanceLexer();
4344
+ this._lexer.advance();
4345
+
4325
4346
  return true;
4326
4347
  }
4327
4348
 
@@ -4336,7 +4357,7 @@ class Parser {
4336
4357
  const token = this._lexer.token;
4337
4358
 
4338
4359
  if (token.kind === tokenKind.TokenKind.NAME && token.value === value) {
4339
- this.advanceLexer();
4360
+ this._lexer.advance();
4340
4361
  } else {
4341
4362
  throw (0, syntaxError_1.syntaxError)(
4342
4363
  this._lexer.source,
@@ -4354,7 +4375,8 @@ class Parser {
4354
4375
  const token = this._lexer.token;
4355
4376
 
4356
4377
  if (token.kind === tokenKind.TokenKind.NAME && token.value === value) {
4357
- this.advanceLexer();
4378
+ this._lexer.advance();
4379
+
4358
4380
  return true;
4359
4381
  }
4360
4382
 
@@ -4441,24 +4463,6 @@ class Parser {
4441
4463
 
4442
4464
  return nodes;
4443
4465
  }
4444
-
4445
- advanceLexer() {
4446
- const { maxTokens } = this._options;
4447
-
4448
- const token = this._lexer.advance();
4449
-
4450
- if (maxTokens !== undefined && token.kind !== tokenKind.TokenKind.EOF) {
4451
- ++this._tokenCounter;
4452
-
4453
- if (this._tokenCounter > maxTokens) {
4454
- throw (0, syntaxError_1.syntaxError)(
4455
- this._lexer.source,
4456
- token.start,
4457
- `Document contains more that ${maxTokens} tokens. Parsing aborted.`,
4458
- );
4459
- }
4460
- }
4461
- }
4462
4466
  }
4463
4467
  /**
4464
4468
  * A helper function to describe a token as a string for debugging.
@@ -6691,7 +6695,6 @@ class WaitingRequest {
6691
6695
  class DataUnitFetcher {
6692
6696
  constructor() {
6693
6697
  this.templateByQuery = new Map();
6694
- this._loadDataTimeout = {};
6695
6698
  this.buldTemplates();
6696
6699
  }
6697
6700
  buldTemplates() {
@@ -6720,9 +6723,9 @@ class DataUnitFetcher {
6720
6723
  }
6721
6724
  }
6722
6725
  }`);
6723
- this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $limit: Int $offset:Int $filters: [InputFilter!] $sort: [InputSort!]) {
6726
+ this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $limit: Int $offset:Int $filter: [InputFilter!] $sort: [InputSort!]) {
6724
6727
  $queryAlias$: fetchDataUnit(name: $dataunit){
6725
- data(limit: $limit offset: $offset filters: $filters sort: $sort){
6728
+ data(limit: $limit offset: $offset filters: $filter sort: $sort){
6726
6729
  limit
6727
6730
  offset
6728
6731
  total
@@ -6751,7 +6754,7 @@ class DataUnitFetcher {
6751
6754
  getDataUnit(entityName, resourceID) {
6752
6755
  const dataUnit = new core.DataUnit(`dd://${entityName}/${resourceID}`);
6753
6756
  dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
6754
- dataUnit.dataLoader = (dataUnit, request) => this.loadData(dataUnit, request);
6757
+ dataUnit.dataLoader = (dataUnit, page, sort, filters) => this.loadData(dataUnit, page, sort, filters);
6755
6758
  dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
6756
6759
  dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
6757
6760
  return dataUnit;
@@ -6788,39 +6791,25 @@ class DataUnitFetcher {
6788
6791
  });
6789
6792
  });
6790
6793
  }
6791
- loadData(dataUnit, request) {
6792
- const duName = dataUnit.name;
6793
- if (this._loadDataTimeout[duName]) {
6794
- clearTimeout(this._loadDataTimeout[duName]);
6795
- delete this._loadDataTimeout[duName];
6796
- }
6797
- return new Promise((resolve, reject) => {
6798
- this._loadDataTimeout[duName] = setTimeout(() => {
6799
- delete this._loadDataTimeout[duName];
6800
- this.doLoadData(dataUnit, request)
6801
- .then(result => resolve(result))
6802
- .catch(reason => reject(reason));
6803
- }, 200);
6804
- });
6805
- }
6806
- doLoadData(dataUnit, request) {
6794
+ loadData(dataUnit, page, sort, filter) {
6807
6795
  return new Promise((resolve, reject) => {
6808
- var _a;
6809
- const { sort, filters, limit, offset, quickFilter } = request;
6810
- const variables = { dataunit: dataUnit.name, sort, filters };
6811
- variables.limit = limit;
6812
- variables.offset = offset;
6813
- if (!core.StringUtils.isEmpty(quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.term)) {
6796
+ var _a, _b, _c;
6797
+ const variables = { dataunit: dataUnit.name, sort, filter };
6798
+ if (page) {
6799
+ variables.limit = page.limit;
6800
+ variables.offset = page.offset;
6801
+ }
6802
+ if (!core.StringUtils.isEmpty((_a = page === null || page === void 0 ? void 0 : page.quickFilter) === null || _a === void 0 ? void 0 : _a.term)) {
6814
6803
  if (variables.filter === undefined) {
6815
6804
  variables.filter = [];
6816
6805
  }
6817
6806
  const quickFilterCriteria = {
6818
6807
  name: "__QUICK_FILTER__",
6819
6808
  expression: "__QUICK_FILTER__",
6820
- params: [{ name: "term", dataType: core.DataType.TEXT, value: quickFilter.term }]
6809
+ params: [{ name: "term", dataType: core.DataType.TEXT, value: page.quickFilter.term }]
6821
6810
  };
6822
- if (((_a = quickFilter === null || quickFilter === void 0 ? void 0 : quickFilter.fields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
6823
- quickFilterCriteria.params.push({ name: "fields", dataType: core.DataType.OBJECT, value: quickFilter.fields });
6811
+ if (((_c = (_b = page.quickFilter) === null || _b === void 0 ? void 0 : _b.fields) === null || _c === void 0 ? void 0 : _c.length) > 0) {
6812
+ quickFilterCriteria.params.push({ name: "fields", dataType: core.DataType.OBJECT, value: page.quickFilter.fields });
6824
6813
  }
6825
6814
  variables.filter.push(quickFilterCriteria);
6826
6815
  }
@@ -6830,32 +6819,16 @@ class DataUnitFetcher {
6830
6819
  query: this.templateByQuery.get("fetchData"),
6831
6820
  })
6832
6821
  .then((resp) => {
6833
- const { limit, offset, total, hasMore, records } = resp.data;
6834
- let paginationInfo;
6835
- if (limit) {
6836
- const firstRecord = offset + 1;
6837
- const lastRecord = offset + Math.min(records.length, limit);
6838
- const currentPage = offset / limit;
6839
- paginationInfo = {
6840
- firstRecord,
6841
- lastRecord,
6842
- total,
6843
- currentPage,
6844
- hasMore
6845
- };
6846
- }
6847
- const processedRecords = [];
6848
- records.forEach((responseRecord) => {
6822
+ const pageResult = resp.data;
6823
+ const records = [];
6824
+ pageResult.records.forEach((responseRecord) => {
6849
6825
  const duRecord = { __record__id__: responseRecord.id };
6850
6826
  responseRecord.fields.forEach(({ name, value }) => {
6851
6827
  duRecord[name] = dataUnit.valueFromString(name, value);
6852
6828
  });
6853
- processedRecords.push(duRecord);
6854
- });
6855
- resolve({
6856
- paginationInfo,
6857
- records: processedRecords
6829
+ records.push(duRecord);
6858
6830
  });
6831
+ resolve(Object.assign(Object.assign({}, pageResult), { records }));
6859
6832
  })
6860
6833
  .catch((error) => {
6861
6834
  reject(error);
@@ -7081,16 +7054,15 @@ class GridConfigFetcher extends ResourceFetcher {
7081
7054
  super(...arguments);
7082
7055
  this.GRID_CONFIG_VERSION = "V3:";
7083
7056
  }
7084
- getConfig(_gridName, resourceID) {
7057
+ getConfig(resourceID) {
7085
7058
  const completePath = `cfg://grid/${this.GRID_CONFIG_VERSION}${resourceID}`;
7086
7059
  return new Promise((resolve, reject) => {
7087
7060
  this.loadResource(completePath)
7088
7061
  .then(loadedResource => {
7089
- let config = undefined;
7090
7062
  if (loadedResource) {
7091
- config = JSON.parse(loadedResource);
7063
+ let config = JSON.parse(loadedResource);
7064
+ resolve(config);
7092
7065
  }
7093
- resolve(config);
7094
7066
  }).catch((error) => {
7095
7067
  reject(error);
7096
7068
  });
@@ -7125,6 +7097,8 @@ class PesquisaFetcher {
7125
7097
  }`);
7126
7098
  }
7127
7099
  loadSearchOptions(entityName, argument, criteria, options) {
7100
+ const cleanText = (argument === null || argument === void 0 ? void 0 : argument.trim()) || undefined;
7101
+ argument = isNaN(Number(cleanText)) && cleanText ? `%${cleanText}` : cleanText;
7128
7102
  return new Promise((resolve, reject) => {
7129
7103
  DataFetcher.get()
7130
7104
  .callGraphQL({
@@ -7283,7 +7257,6 @@ const SnkApplication = class {
7283
7257
  index.registerInstance(this, hostRef);
7284
7258
  this.applicationLoaded = index.createEvent(this, "applicationLoaded", 7);
7285
7259
  this.applicationLoading = index.createEvent(this, "applicationLoading", 7);
7286
- this._duCache = new Map();
7287
7260
  this._requestListener = new RequestListenerLoadingBar();
7288
7261
  }
7289
7262
  get parameters() {
@@ -7314,9 +7287,6 @@ const SnkApplication = class {
7314
7287
  }
7315
7288
  });
7316
7289
  }
7317
- /**
7318
- * Caso o usuário logado seja o SUP.
7319
- */
7320
7290
  async isUserSup() {
7321
7291
  return new Promise((resolve, reject) => {
7322
7292
  this.auth.then((authorization) => {
@@ -7326,9 +7296,6 @@ const SnkApplication = class {
7326
7296
  });
7327
7297
  });
7328
7298
  }
7329
- /**
7330
- * Se o usuário logado tem permissão pra determinada ação.
7331
- */
7332
7299
  async hasAccess(access) {
7333
7300
  return new Promise((resolve, reject) => {
7334
7301
  this.auth.then((authorization) => {
@@ -7338,9 +7305,6 @@ const SnkApplication = class {
7338
7305
  });
7339
7306
  });
7340
7307
  }
7341
- /**
7342
- * Retorna todos os acessos do usuário logado.
7343
- */
7344
7308
  async getAllAccess() {
7345
7309
  return new Promise((resolve, reject) => {
7346
7310
  this.auth.then((authorization) => {
@@ -7355,55 +7319,33 @@ const SnkApplication = class {
7355
7319
  });
7356
7320
  });
7357
7321
  }
7358
- /**
7359
- * Retorna o valor de um parâmetro do tipo string.
7360
- */
7322
+ async getAuthList(_auth) {
7323
+ return await (new MGEAuthorization()).parseFromJSON(_auth);
7324
+ }
7361
7325
  async getStringParam(name) {
7362
7326
  return this.parameters.asString(name, this.resourceID);
7363
7327
  }
7364
- /**
7365
- * Retorna o valor de um parâmetro do tipo Inteiro.
7366
- */
7367
7328
  async getIntParam(name) {
7368
7329
  return this.parameters.asInteger(name, this.resourceID);
7369
7330
  }
7370
- /**
7371
- * Retorna o valor de um parâmetro do tipo Decimal.
7372
- */
7373
7331
  async getFloatParam(name) {
7374
7332
  return this.parameters.asFloat(name, this.resourceID);
7375
7333
  }
7376
- /**
7377
- * Retorna o valor de um parâmetro do tipo booleano.
7378
- */
7379
7334
  async getBooleanParam(name) {
7380
7335
  return this.parameters.asBoolean(name, this.resourceID);
7381
7336
  }
7382
- /**
7383
- * Retorna o valor de um parâmetro do tipo data.
7384
- */
7385
7337
  async getDateParam(name) {
7386
7338
  return this.parameters.asDate(name, this.resourceID);
7387
7339
  }
7388
- /**
7389
- * Mostra o conteúdo passado em um Popup
7390
- */
7391
7340
  async showPopUp(content) {
7341
+ this.clearPopUpContent();
7392
7342
  this._popUp.appendChild(content);
7393
- this._popUp["opened"] = true;
7343
+ this._popUp.opened = true;
7394
7344
  }
7395
- /**
7396
- * Fecha o popup, liberando o conteúdo.
7397
- */
7398
7345
  async closePopUp() {
7399
- Array.from(this._popUp.children).forEach(c => {
7400
- this._popUp.removeChild(c);
7401
- });
7402
- this._popUp["opened"] = false;
7346
+ this.clearPopUpContent();
7347
+ this._popUp.opened = false;
7403
7348
  }
7404
- /**
7405
- * Verifica se a licença do cliente tem determinado opcional (produto)
7406
- */
7407
7349
  async temOpcional(opcional) {
7408
7350
  const opts = opcional.split(",");
7409
7351
  return new Promise((resolve, reject) => {
@@ -7427,10 +7369,6 @@ const SnkApplication = class {
7427
7369
  });
7428
7370
  });
7429
7371
  }
7430
- /**
7431
- * Retorna a configuração de um recurso por service broker
7432
- * Veja também o método "loadConfig"
7433
- */
7434
7372
  async getConfig(key) {
7435
7373
  let payload = {
7436
7374
  "serviceName": "SystemUtilsSP.getConf",
@@ -7448,9 +7386,6 @@ const SnkApplication = class {
7448
7386
  .catch(error => reject(error));
7449
7387
  });
7450
7388
  }
7451
- /**
7452
- * Salva a configuração de determinado recurso.
7453
- */
7454
7389
  async saveConfig(key, data) {
7455
7390
  let payload = {
7456
7391
  "serviceName": "SystemUtilsSP.saveConf",
@@ -7469,97 +7404,42 @@ const SnkApplication = class {
7469
7404
  .catch(error => reject(error));
7470
7405
  });
7471
7406
  }
7472
- /**
7473
- * Acessa informações de contexto "empurrados" na abertura da tela
7474
- */
7475
7407
  async getAttributeFromHTMLWrapper(attribName) {
7476
7408
  return Promise.resolve(window[attribName]);
7477
7409
  }
7478
- /**
7479
- * Abre determinada tela, repassando pkObject
7480
- */
7481
7410
  async openApp(resourceId, pkObject) {
7482
7411
  Workspace.openAppActivity(resourceId, pkObject);
7483
7412
  }
7484
- /**
7485
- * Cria o DataUnit a partir do nome da entidade.
7486
- */
7487
7413
  async createDataunit(entityName) {
7488
7414
  return new Promise(resolve => {
7489
7415
  const dataUnit = this.dataUnitFetcher.getDataUnit(entityName, this.resourceID);
7490
7416
  dataUnit.loadMetadata().then(() => resolve(dataUnit));
7491
7417
  });
7492
7418
  }
7493
- /**
7494
- * Cria e armazena o DataUnit em um cache
7495
- */
7496
- async getDataUnit(entityName, dataUnitName) {
7497
- return new Promise((resolve, reject) => {
7498
- const dataUnit = this._duCache.get(dataUnitName);
7499
- if (dataUnit) {
7500
- resolve(dataUnit);
7501
- }
7502
- else {
7503
- this.createDataunit(entityName).then(dataUnit => {
7504
- if (dataUnitName) {
7505
- this._duCache.set(dataUnitName, dataUnit);
7506
- }
7507
- resolve(dataUnit);
7508
- }).catch(reason => reject(reason));
7509
- }
7510
- });
7511
- }
7512
- /**
7513
- * Retorna o resourceID da tela em questão.
7514
- */
7515
7419
  async getResourceID() {
7516
7420
  return Promise.resolve(this.resourceID);
7517
7421
  }
7518
- /**
7519
- * Mostra o diálogo de alerta de acordo com os parâmetros passados.
7520
- */
7521
7422
  async alert(title, message, icon, options) {
7522
7423
  return utils.ApplicationUtils.alert(title, message, icon, options);
7523
7424
  }
7524
- /**
7525
- * Mostra o diálogo de erro de acordo com os parâmetros passados.
7526
- */
7527
7425
  async error(title, message, icon, options) {
7528
7426
  return utils.ApplicationUtils.error(title, message, icon, options);
7529
7427
  }
7530
- /**
7531
- * Exibe um diálogo de confirmação
7532
- */
7533
7428
  async confirm(title, message, icon, critical, options) {
7534
7429
  return utils.ApplicationUtils.confirm(title, message, icon, critical, options);
7535
7430
  }
7536
- /**
7537
- * Mostra uma informação efêmera (de segundo plano).
7538
- */
7539
7431
  async info(message, options) {
7540
7432
  return utils.ApplicationUtils.info(message, options);
7541
7433
  }
7542
- /**
7543
- * Busca a configuração de formulário.
7544
- */
7545
7434
  async loadFormConfig(name) {
7546
7435
  return this.formConfigFetcher.loadFormConfig(name, this.resourceID);
7547
7436
  }
7548
- /**
7549
- * Busca a configuração de grade.
7550
- */
7551
- async loadGridConfig(name) {
7552
- return this.gridConfigFetcher.getConfig(name, this.resourceID);
7437
+ async loadGridConfig() {
7438
+ return this.gridConfigFetcher.getConfig(this.resourceID);
7553
7439
  }
7554
- /**
7555
- * Salva a configuração de grade.
7556
- */
7557
7440
  async saveGridConfig(config) {
7558
7441
  return this.gridConfigFetcher.saveConfig(config, this.resourceID);
7559
7442
  }
7560
- async getAuthList(_auth) {
7561
- return await (new MGEAuthorization()).parseFromJSON(_auth);
7562
- }
7563
7443
  get urlParams() {
7564
7444
  if (!this._urlParams) {
7565
7445
  this._urlParams = UrlUtils.getQueryParams(location.search);
@@ -7612,7 +7492,7 @@ const SnkApplication = class {
7612
7492
  };
7613
7493
  dependencies === null || dependencies === void 0 ? void 0 : dependencies.filter(dep => { var _a; return (_a = dep.masterFields) === null || _a === void 0 ? void 0 : _a.every(f => { var _a; return (_a = dataUnit.getField(f)) === null || _a === void 0 ? void 0 : _a.visible; }); }).forEach(dependency => {
7614
7494
  var _a;
7615
- if (dependency.type === core.DependencyType.SEARCHING) {
7495
+ if (dependency.type === UnitMetadata.DependencyType.SEARCHING) {
7616
7496
  if (((_a = dependency.masterFields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
7617
7497
  criteria = {
7618
7498
  expression: dependency.expression,
@@ -7637,7 +7517,7 @@ const SnkApplication = class {
7637
7517
  pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(ENTITYNAME, text, criteria, searchOptions);
7638
7518
  pesquisaContent.selectItem = (option) => {
7639
7519
  accept(option);
7640
- this.cleanPopUpTitle();
7520
+ this.clearPopUpTitle();
7641
7521
  this.closePopUp();
7642
7522
  };
7643
7523
  this.setPopUpTitle(DESCRIPTIONENTITY);
@@ -7654,11 +7534,18 @@ const SnkApplication = class {
7654
7534
  accept(window['isDebugMode']);
7655
7535
  });
7656
7536
  }
7657
- cleanPopUpTitle() {
7658
- this._popUp['ezTitle'] = "";
7537
+ clearPopUpContent() {
7538
+ if (this._popUp) {
7539
+ Array.from(this._popUp.children).forEach(c => {
7540
+ this._popUp.removeChild(c);
7541
+ });
7542
+ }
7543
+ }
7544
+ clearPopUpTitle() {
7545
+ this._popUp.ezTitle = "";
7659
7546
  }
7660
7547
  setPopUpTitle(title) {
7661
- this._popUp['ezTitle'] = title;
7548
+ this._popUp.ezTitle = title;
7662
7549
  }
7663
7550
  componentWillLoad() {
7664
7551
  this._errorHandler = new SnkErrorHandler(this);
@@ -7668,7 +7555,6 @@ const SnkApplication = class {
7668
7555
  });
7669
7556
  core.ApplicationContext.setContextValue("__EZUI__GRID_LICENSE__", agGridLicense);
7670
7557
  core.ErrorTracking.init();
7671
- core.ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
7672
7558
  }
7673
7559
  connectedCallback() {
7674
7560
  DataFetcher.addRequestListener(this._requestListener);
@@ -2,10 +2,10 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-532bcc28.js');
5
+ const index = require('./index-1133bc2a.js');
6
6
  const core = require('@sankhyalabs/core');
7
7
 
8
- const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color:var(--text--primary, #626e82);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-medium, 12px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px) display: block;max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input-close.sc-snk-pesquisa{cursor:pointer}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:#f0f2f5;width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}";
8
+ const snkPesquisaCss = ".sc-snk-pesquisa-h{--snk-pesquisa--font-size:var(--text--medium, 14px);--snk-pesquisa--font-family:var(--font-pattern, Arial);--snk-pesquisa--font-weight:var(--text-weight--medium, 400);--snk-pesquisa__records--color:var(--text--primary, #626e82);--snk-pesquisa__records--padding-vertical:var(--space--medium, 12px);--snk-pesquisa__content--padding-right:var(--space--small, 6px);--snk-pesquisa__content-scrollbar--background-color:var(--title--primary, #2B3A54);--snk-pesquisa__content-scrollbar--border-radius:var(--border--radius-small, 6px);--snk-pesquisa__content-scrollbar--width:var(--space--medium, 12px);--snk-pesquisa__btn--color:var(--title--primary, #2B3A54);--snk-pesquisa__btn-disabled--color:var(--text--disable, #AFB6C0);--snk-pesquisa__btn-hover--color:var(--color--primary, #4e4e4e);max-height:100%;height:100%;display:flex;flex-direction:column;overflow-y:auto}.snk-pesquisa.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%}.snk-pesquisa__input.sc-snk-pesquisa{display:flex;width:100%;box-sizing:border-box;padding-top:4px;padding-right:4px}.snk-pesquisa__input.sc-snk-pesquisa ez-icon.sc-snk-pesquisa{--ez-icon--color:inherit;font-weight:var(--text-weight--large, 600)}.snk-pesquisa__content.sc-snk-pesquisa{display:flex;flex-direction:column;height:100%;overflow-y:auto;padding-right:var(--snk-pesquisa__content--padding-right)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-track{background-color:#f0f2f5;border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar-thumb{background-color:var(--snk-pesquisa__content-scrollbar--background-color);border-radius:var(--snk-pesquisa__content-scrollbar--border-radius)}.snk-pesquisa__content.sc-snk-pesquisa::-webkit-scrollbar{background-color:#f0f2f5;width:var(--snk-pesquisa__content-scrollbar--width);max-width:var(--snk-pesquisa__content-scrollbar--width);min-width:var(--snk-pesquisa__content-scrollbar--width)}.snk-pesquisa__records.sc-snk-pesquisa{font-family:var(--snk-pesquisa--font-family);font-weight:var(--snk-pesquisa--font-weight);font-size:var(--snk-pesquisa--font-size);color:var(--snk-pesquisa__records--color);padding-bottom:var(--snk-pesquisa__records--padding-vertical);padding-top:var(--snk-pesquisa__records--padding-vertical)}.snk-pesquisa__btn.sc-snk-pesquisa{outline:none;border:none;background:none;cursor:pointer;color:var(--snk-pesquisa__btn--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:disabled:hover{cursor:unset;color:var(--snk-pesquisa__btn-disabled--color)}.snk-pesquisa__btn.sc-snk-pesquisa:hover{color:var(--snk-pesquisa__btn-hover--color)}";
9
9
 
10
10
  const SnkPesquisa = class {
11
11
  constructor(hostRef) {
@@ -299,7 +299,10 @@ const SnkPesquisa = class {
299
299
  : 'Os resultados de sua pesquisa aparecerão aqui...';
300
300
  }
301
301
  render() {
302
- return (index.h(index.Host, null, index.h("div", { class: "snk-pesquisa" }, index.h("div", { class: "snk-pesquisa__input" }, index.h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument }, index.h("ez-icon", { slot: "leftIcon", iconName: "search" }), index.h("ez-icon", { class: "snk-pesquisa__input-close", slot: "rightIcon", iconName: "close", onClick: () => { this.clearSearch(); } })), index.h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() })), index.h("label", { class: "snk-pesquisa__records" }, this.getMessageView()), index.h("div", { class: "snk-pesquisa__content" }, this._itemList && this._itemList.map((item) => {
302
+ var _a;
303
+ return (index.h(index.Host, null, index.h("div", { class: "snk-pesquisa" }, index.h("div", { class: "snk-pesquisa__input" }, index.h("ez-text-input", { label: "Buscar", class: "ez-margin-right--medium", canShowError: false, ref: (ref) => this._textInput = ref, onEzChange: (event) => this.onChangeValue(event), value: this.argument }, index.h("ez-icon", { slot: "leftIcon", iconName: "search" }), this.argument && ((_a = this._textInput) === null || _a === void 0 ? void 0 : _a.value)
304
+ ? index.h("button", { slot: "rightIcon", class: "snk-pesquisa__btn", onClick: () => this.clearSearch() }, index.h("ez-icon", { iconName: "close" }))
305
+ : undefined), index.h("ez-button", { class: "ez-button--primary", label: "Pesquisar", onClick: () => this.onClickSearch() })), index.h("label", { class: "snk-pesquisa__records" }, this.getMessageView()), index.h("div", { class: "snk-pesquisa__content" }, this._itemList && this._itemList.map((item) => {
303
306
  return (index.h("ez-card-item", { onEzClick: (event) => this.createOption(event.detail), item: item }));
304
307
  })))));
305
308
  }