@sankhyalabs/sankhyablocks 1.3.2 → 1.3.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.
Files changed (47) hide show
  1. package/dist/cjs/{index-4720dab8.js → index-8272993f.js} +439 -7
  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 +260 -71
  5. package/dist/cjs/snk-pesquisa.cjs.entry.js +19 -0
  6. package/dist/cjs/teste-pesquisa.cjs.entry.js +37 -0
  7. package/dist/collection/collection-manifest.json +3 -1
  8. package/dist/collection/components/snk-application/snk-application.js +104 -3
  9. package/dist/collection/components/snk-pesquisa/snk-pesquisa.css +3 -0
  10. package/dist/collection/components/snk-pesquisa/snk-pesquisa.js +74 -0
  11. package/dist/collection/components/teste-pesquisa/teste-pesquisa.css +3 -0
  12. package/dist/collection/components/teste-pesquisa/teste-pesquisa.js +33 -0
  13. package/dist/collection/lib/http/data-fetcher/DataFetcher.js +47 -0
  14. package/dist/collection/lib/http/data-fetcher/fetchers/dataunit-fetcher.js +51 -31
  15. package/dist/collection/lib/http/data-fetcher/fetchers/pesquisa-fetcher.js +82 -0
  16. package/dist/collection/lib/workspace/workspace.js +2 -1
  17. package/dist/components/snk-application.js +1 -7089
  18. package/dist/components/snk-application2.js +7288 -0
  19. package/dist/components/snk-pesquisa.d.ts +11 -0
  20. package/dist/components/snk-pesquisa.js +6 -0
  21. package/dist/components/snk-pesquisa2.js +34 -0
  22. package/dist/components/teste-pesquisa.d.ts +11 -0
  23. package/dist/components/teste-pesquisa.js +63 -0
  24. package/dist/esm/{index-72d4e2e0.js → index-427447f8.js} +439 -8
  25. package/dist/esm/loader.js +2 -2
  26. package/dist/esm/sankhyablocks.js +2 -2
  27. package/dist/esm/snk-application.entry.js +261 -72
  28. package/dist/esm/snk-pesquisa.entry.js +15 -0
  29. package/dist/esm/teste-pesquisa.entry.js +33 -0
  30. package/dist/sankhyablocks/p-727ea2f4.entry.js +63 -0
  31. package/dist/sankhyablocks/p-91ca1a98.entry.js +1 -0
  32. package/dist/sankhyablocks/p-e6ba985e.entry.js +1 -0
  33. package/dist/sankhyablocks/p-ee5a384b.js +2 -0
  34. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  35. package/dist/types/components/snk-application/snk-application.d.ts +8 -0
  36. package/dist/types/components/snk-pesquisa/snk-pesquisa.d.ts +7 -0
  37. package/dist/types/components/teste-pesquisa/teste-pesquisa.d.ts +6 -0
  38. package/dist/types/components.d.ts +34 -0
  39. package/dist/types/lib/http/data-fetcher/DataFetcher.d.ts +3 -0
  40. package/dist/types/lib/http/data-fetcher/fetchers/dataunit-fetcher.d.ts +1 -1
  41. package/dist/types/lib/http/data-fetcher/fetchers/pesquisa-fetcher.d.ts +17 -0
  42. package/package.json +1 -1
  43. package/react/components.d.ts +2 -0
  44. package/react/components.js +2 -0
  45. package/react/components.js.map +1 -1
  46. package/dist/sankhyablocks/p-76b95007.entry.js +0 -57
  47. package/dist/sankhyablocks/p-a33afc3b.js +0 -2
@@ -1,6 +1,7 @@
1
- import { r as registerInstance, c as createEvent, h } from './index-72d4e2e0.js';
2
- import { DataUnit, ChangeOperation, DateUtils, StringUtils, ApplicationContext } from '@sankhyalabs/core';
1
+ import { r as registerInstance, c as createEvent, h } from './index-427447f8.js';
2
+ import { DataUnit, StringUtils, ChangeOperation, DateUtils, DataType, ApplicationContext } from '@sankhyalabs/core';
3
3
  import { ApplicationUtils } from '@sankhyalabs/ezui/dist/collection/utils';
4
+ import { DependencyType } from '@sankhyalabs/core/dist/dataunit/metadata/UnitMetadata';
4
5
 
5
6
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
6
7
 
@@ -6429,6 +6430,30 @@ Object.defineProperty(exports, "GraphQLWebSocketClient", { enumerable: true, get
6429
6430
  //# sourceMappingURL=index.js.map
6430
6431
  });
6431
6432
 
6433
+ class UrlUtils {
6434
+ static getQueryParams(queryString) {
6435
+ const params = new Map();
6436
+ const re = /[?&]?([^=]+)=([^&]*)/g;
6437
+ let tokens;
6438
+ //Necessário por causa da tela Histórico Padrão que possui resourceID com acento
6439
+ queryString = window.unescape(queryString);
6440
+ queryString = queryString.split("+").join(" ");
6441
+ while ((tokens = re.exec(queryString))) {
6442
+ params.set(window.decodeURIComponent(tokens[1]), tokens[2]);
6443
+ }
6444
+ //Inserimos a urlBase no params.
6445
+ params.set("urlBase", this.getUrlBase());
6446
+ if (window["moduleID"] && window["URIServiceBroker"]) {
6447
+ params.set("moduleID", window["moduleID"]);
6448
+ params.set("URIServiceBroker", window["URIServiceBroker"]);
6449
+ }
6450
+ return params;
6451
+ }
6452
+ static getUrlBase() {
6453
+ return `${location.protocol}"//"${location.hostname}${location.port ? ":" + location.port : ""}`;
6454
+ }
6455
+ }
6456
+
6432
6457
  class HttpFetcher {
6433
6458
  constructor() {
6434
6459
  this.watingRequestsById = new Map();
@@ -6475,6 +6500,52 @@ class HttpFetcher {
6475
6500
  return (_a = this.getWatingRequest(reqKey)) === null || _a === void 0 ? void 0 : _a.promise;
6476
6501
  }
6477
6502
  }
6503
+ resolveURL() {
6504
+ if (window['mock_url'])
6505
+ return window['mock_url'];
6506
+ return UrlUtils.getUrlBase();
6507
+ }
6508
+ getContext() {
6509
+ const urlParams = UrlUtils.getQueryParams(location.search);
6510
+ return {
6511
+ baseUrl: `${this.resolveURL()}/mge/service.sbr`,
6512
+ appName: "SankhyaBlocks",
6513
+ mgeSession: `${window['skw_session'] || urlParams.mgeSession}`,
6514
+ globalID: "85C0093DFA240EAB699B4E47A10215BD",
6515
+ resourceID: "br.com.sankhya.mov.bancaria"
6516
+ };
6517
+ }
6518
+ async callServiceBroker(serviceName, payload) {
6519
+ return new Promise((accept, reject) => {
6520
+ const ctx = this.getContext();
6521
+ const url = `${ctx.baseUrl}?serviceName=${serviceName}&counter=21&application=${ctx.appName}&outputType=json&preventTransform=false&mgeSession=${ctx.mgeSession}&resourceID=${ctx.resourceID}&globalID=${ctx.globalID}&allowConcurrentCalls=true`;
6522
+ document.cookie = `JSESSIONID=${ctx.mgeSession};`;
6523
+ const http = new XMLHttpRequest();
6524
+ http.open("POST", url, true);
6525
+ http.withCredentials = true;
6526
+ http.send(payload);
6527
+ http.onreadystatechange = function () {
6528
+ if (this.readyState == 4 && this.status == 200) {
6529
+ try {
6530
+ const jsonResp = JSON.parse(this.responseText);
6531
+ if (jsonResp.status == 1) {
6532
+ accept(jsonResp.responseBody);
6533
+ }
6534
+ else {
6535
+ reject(jsonResp);
6536
+ }
6537
+ }
6538
+ catch (e) {
6539
+ console.warn(`callServiceBroker error to parser response to JSON ${e}`);
6540
+ reject(this.responseText);
6541
+ }
6542
+ }
6543
+ else if (this.readyState == 4 && this.status != 200) {
6544
+ reject(this.responseText);
6545
+ }
6546
+ };
6547
+ });
6548
+ }
6478
6549
  getReqKey(req) {
6479
6550
  return window.btoa(this.hashCode(`${req.query}${JSON.stringify(req.values || "")}`)).replace(/=/g, "");
6480
6551
  }
@@ -6600,6 +6671,7 @@ class DataUnitFetcher {
6600
6671
  name
6601
6672
  defaultValue
6602
6673
  label
6674
+ visible
6603
6675
  readOnly
6604
6676
  required
6605
6677
  dataType
@@ -6616,10 +6688,10 @@ class DataUnitFetcher {
6616
6688
  }
6617
6689
  }
6618
6690
  }`);
6619
- this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $first: Int $offset:Int $filter: [Filter!] $sort: [Sort!]) {
6691
+ this.templateByQuery.set("fetchData", dist.gql `query($dataunit: String! $limit: Int $offset:Int $filter: [Filter!] $sort: [Sort!]) {
6620
6692
  $queryAlias$: fetchDataUnit(name: $dataunit){
6621
- data(first: $first offset: $offset filters: $filter sort: $sort){
6622
- first
6693
+ data(limit: $limit offset: $offset filters: $filter sort: $sort){
6694
+ limit
6623
6695
  offset
6624
6696
  total
6625
6697
  hasMore
@@ -6647,7 +6719,7 @@ class DataUnitFetcher {
6647
6719
  getDataUnit(entityName, resourceID) {
6648
6720
  const dataUnit = new DataUnit(`dd://${entityName}/${resourceID}`);
6649
6721
  dataUnit.metadataLoader = (dataUnit) => this.loadMetadata(dataUnit);
6650
- dataUnit.dataLoader = (dataUnit, sort, filters) => this.loadData(dataUnit, sort, filters);
6722
+ dataUnit.dataLoader = (dataUnit, page, sort, filters) => this.loadData(dataUnit, page, sort, filters);
6651
6723
  dataUnit.saveLoader = (dataUnit, changes) => this.saveData(dataUnit, changes);
6652
6724
  dataUnit.removeLoader = (dataUnit, recordIds) => this.removeRecords(dataUnit, recordIds);
6653
6725
  return dataUnit;
@@ -6681,24 +6753,36 @@ class DataUnitFetcher {
6681
6753
  });
6682
6754
  });
6683
6755
  }
6684
- loadData(dataUnit, sort, filters) {
6756
+ loadData(dataUnit, page, sort, filters) {
6685
6757
  return new Promise((resolve, reject) => {
6758
+ const variables = { dataunit: dataUnit.name, sort, filters };
6759
+ if (page) {
6760
+ variables.limit = page.limit;
6761
+ variables.offset = page.offset;
6762
+ }
6763
+ if (!StringUtils.isEmpty(page === null || page === void 0 ? void 0 : page.quickFilter)) {
6764
+ variables.filter = [{
6765
+ name: "__ALL_SEARCHABLE_FIELDS__",
6766
+ expression: "__ALL_SEARCHABLE_FIELDS__",
6767
+ params: [{ name: "term", value: page.quickFilter }]
6768
+ }];
6769
+ }
6686
6770
  HttpFetcher.get()
6687
6771
  .callGraphQL({
6688
- values: { dataunit: dataUnit.name, sort, filters },
6772
+ values: variables,
6689
6773
  query: this.templateByQuery.get("fetchData"),
6690
6774
  })
6691
6775
  .then((resp) => {
6692
- const result = resp.data;
6693
- const dataUnitRecords = [];
6694
- result.records.forEach((responseRecord) => {
6776
+ const pageResult = resp.data;
6777
+ const records = [];
6778
+ pageResult.records.forEach((responseRecord) => {
6695
6779
  const duRecord = { __record__id__: responseRecord.id };
6696
6780
  responseRecord.fields.forEach(({ name, value }) => {
6697
6781
  duRecord[name] = dataUnit.valueFromString(name, value);
6698
6782
  });
6699
- dataUnitRecords.push(duRecord);
6783
+ records.push(duRecord);
6700
6784
  });
6701
- resolve(dataUnitRecords);
6785
+ resolve(Object.assign(Object.assign({}, pageResult), { records }));
6702
6786
  })
6703
6787
  .catch((error) => {
6704
6788
  reject(error);
@@ -6708,10 +6792,17 @@ class DataUnitFetcher {
6708
6792
  saveData(dataUnit, duChanges) {
6709
6793
  const changes = duChanges.map((change) => {
6710
6794
  const { dataUnit: changeDU, record, updatingFields, operation } = change;
6711
- const parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
6712
- return { fieldName, value: this.formatValueToServer(value) };
6713
- });
6714
- return { dataUnit: changeDU, updatingFields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
6795
+ let parsedUpdatingFields;
6796
+ if (updatingFields) {
6797
+ parsedUpdatingFields = Object.entries(updatingFields).map(([fieldName, value]) => {
6798
+ return { fieldName, value: formatValueToServer(value) };
6799
+ });
6800
+ }
6801
+ const reqChange = { dataUnit: changeDU, updatingFields: parsedUpdatingFields, operation, recordId: record.__record__id__ };
6802
+ if (change.sourceId) {
6803
+ reqChange.sourceId = change.sourceId;
6804
+ }
6805
+ return reqChange;
6715
6806
  });
6716
6807
  return new Promise((resolve, reject) => {
6717
6808
  HttpFetcher.get()
@@ -6738,21 +6829,6 @@ class DataUnitFetcher {
6738
6829
  });
6739
6830
  });
6740
6831
  }
6741
- formatValueToServer(value) {
6742
- if (value === undefined)
6743
- return value;
6744
- try {
6745
- if (value instanceof Date || typeof value === 'string') {
6746
- return value.toString();
6747
- }
6748
- //Any others objects
6749
- value = JSON.stringify(value);
6750
- }
6751
- catch (_a) {
6752
- value = value.toString();
6753
- }
6754
- return value;
6755
- }
6756
6832
  removeRecords(dataUnit, recordIds) {
6757
6833
  const changes = recordIds.map((recordId) => {
6758
6834
  return { dataUnit: dataUnit.name, operation: ChangeOperation.DELETE, recordId };
@@ -6772,38 +6848,30 @@ class DataUnitFetcher {
6772
6848
  });
6773
6849
  }
6774
6850
  }
6775
-
6776
- class UrlUtils {
6777
- static getQueryParams(queryString) {
6778
- const params = new Map();
6779
- const re = /[?&]?([^=]+)=([^&]*)/g;
6780
- let tokens;
6781
- //Necessário por causa da tela Histórico Padrão que possui resourceID com acento
6782
- queryString = window.unescape(queryString);
6783
- queryString = queryString.split("+").join(" ");
6784
- while ((tokens = re.exec(queryString))) {
6785
- params.set(window.decodeURIComponent(tokens[1]), tokens[2]);
6786
- }
6787
- //Inserimos a urlBase no params.
6788
- params.set("urlBase", this.getUrlBase());
6789
- if (window["moduleID"] && window["URIServiceBroker"]) {
6790
- params.set("moduleID", window["moduleID"]);
6791
- params.set("URIServiceBroker", window["URIServiceBroker"]);
6851
+ const formatValueToServer = (value) => {
6852
+ if (value === undefined)
6853
+ return value;
6854
+ try {
6855
+ if (value instanceof Date) {
6856
+ return value.toString();
6792
6857
  }
6793
- return params;
6858
+ //Any others objects
6859
+ value = JSON.stringify(value);
6794
6860
  }
6795
- static getUrlBase() {
6796
- return `${location.protocol}"//"${location.hostname}${location.port ? ":" + location.port : ""}`;
6861
+ catch (_a) {
6862
+ value = value.toString();
6797
6863
  }
6798
- }
6864
+ return value;
6865
+ };
6799
6866
 
6867
+ var _a;
6800
6868
  class Workspace {
6801
6869
  static openAppActivity(resourceId, pkObject) {
6802
6870
  var _a;
6803
6871
  (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.openAppActivity(resourceId, pkObject);
6804
6872
  }
6805
6873
  }
6806
- Workspace.resourceID = window["workspace"].resourceID;
6874
+ Workspace.resourceID = (_a = window["workspace"]) === null || _a === void 0 ? void 0 : _a.resourceID;
6807
6875
 
6808
6876
  class ParametersFetcher {
6809
6877
  constructor() {
@@ -6916,22 +6984,85 @@ class FormConfigFetcher extends ResourceFetcher {
6916
6984
  }
6917
6985
  }
6918
6986
 
6919
- const mockByEntity = {
6920
- "ImplantacaoSaldoConta": [{ "value": 6, "label": "Conta Financeiro" }, { "value": 7, "label": "Conta Banco do Brasil" }],
6921
- "HistoricoBancario": [{ "value": 9, "label": "Lanç. Origem" }, { "value": 8, "label": "Lanç. Origem 2" }],
6922
- "ContaDestino": [{ "value": 10, "label": "Conta BB" }, { "value": 7, "label": "Conta Santander" }],
6923
- "HistoricoBancarioDestino": [{ "value": 11, "label": "Contra Bradesco" }, { "value": 13, "label": "Contra Destino" }],
6924
- "Usuario": [{ "value": 0, "label": "SUP" }],
6925
- "ContaBancaria": [{ "value": 10, "label": "Conta 10" }, { "value": 17, "label": "Conta 17" }],
6926
- "TipoOperacao": [{ "value": 4, "label": "Entrada NFse" }, { "value": 5, "label": "Outra top" }, { "value": 6, "label": "Top 6" }]
6927
- };
6928
- const pesquisaLoadOptions = (searchArgument, fieldName, dataUnit) => {
6929
- var _a;
6930
- console.log(searchArgument);
6931
- const field = dataUnit.getField(fieldName);
6932
- const entityName = (_a = field.properties) === null || _a === void 0 ? void 0 : _a.ENTITYNAME;
6933
- return (mockByEntity[entityName] || []);
6934
- };
6987
+ class PesquisaFetcher {
6988
+ constructor() {
6989
+ this.templateByQuery = new Map();
6990
+ this.buldTemplates();
6991
+ }
6992
+ buldTemplates() {
6993
+ this.templateByQuery.set("search", dist.gql `query($entityName: String! $argument: String $criteria: SearchCriteria) {
6994
+ $queryAlias$: search(entityName: $entityName argument: $argument criteria: $criteria){
6995
+ value
6996
+ label
6997
+ }
6998
+ }`);
6999
+ }
7000
+ loadSearchOptions(entityName, argument, criteria) {
7001
+ return new Promise((resolve, reject) => {
7002
+ HttpFetcher.get()
7003
+ .callGraphQL({
7004
+ values: { argument, entityName, criteria },
7005
+ query: this.templateByQuery.get("search"),
7006
+ })
7007
+ .then((result) => {
7008
+ resolve(result);
7009
+ })
7010
+ .catch((error) => {
7011
+ reject(error);
7012
+ });
7013
+ });
7014
+ }
7015
+ loadAdvancedSearch(entityName, argument, criteria) {
7016
+ const serviceName = "PesquisaSP.getSuggestion";
7017
+ const externalCriteria = {
7018
+ query: {
7019
+ $: criteria === null || criteria === void 0 ? void 0 : criteria.expression
7020
+ }
7021
+ };
7022
+ if ((criteria === null || criteria === void 0 ? void 0 : criteria.params.length) > 0) {
7023
+ externalCriteria.params = {
7024
+ param: criteria.params.map(p => { return { $: p.value, type: convertParamType(p.dataType) }; })
7025
+ };
7026
+ }
7027
+ const reqBody = {
7028
+ "serviceName": serviceName,
7029
+ "requestBody": {
7030
+ "criteria": {
7031
+ "entityName": entityName,
7032
+ "compacted": false,
7033
+ "ignoreEntityCriteria": false,
7034
+ "limit": "5",
7035
+ "query": { "$": argument },
7036
+ "orderByDesc": false,
7037
+ "options": { "showInactives": false },
7038
+ "externalCriteria": externalCriteria
7039
+ },
7040
+ "clientEventList": {
7041
+ "clientEvent": []
7042
+ }
7043
+ }
7044
+ };
7045
+ return new Promise((resolve, reject) => {
7046
+ HttpFetcher.get()
7047
+ .callServiceBroker("PesquisaSP.getSuggestion", JSON.stringify(reqBody))
7048
+ .then(result => resolve(result))
7049
+ .catch(error => reject(error));
7050
+ });
7051
+ }
7052
+ }
7053
+ function convertParamType(dataType) {
7054
+ //Alerta: Cuidado pra não contaminar o DataType com a implementação
7055
+ //atual da pesquisa... em geral, somente inteiros,
7056
+ //data (com ou sem hora) e string são realmente relevantes
7057
+ switch (dataType) {
7058
+ case DataType.NUMBER:
7059
+ return "I";
7060
+ case DataType.DATE:
7061
+ return "D";
7062
+ default:
7063
+ return "S";
7064
+ }
7065
+ }
6935
7066
 
6936
7067
  const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
6937
7068
 
@@ -6971,6 +7102,16 @@ const SnkApplication = class {
6971
7102
  async getDateParam(name) {
6972
7103
  return this.parameters.asDate(name, this.resourceID);
6973
7104
  }
7105
+ async showPopUp(content) {
7106
+ this._popUp.appendChild(content);
7107
+ this._popUp["opened"] = true;
7108
+ }
7109
+ async closePopUp() {
7110
+ Array.from(this._popUp.children).forEach(c => {
7111
+ this._popUp.removeChild(c);
7112
+ });
7113
+ this._popUp["opened"] = false;
7114
+ }
6974
7115
  async temOpcional(opcional) {
6975
7116
  const opts = opcional.split(",");
6976
7117
  return new Promise((resolve, reject) => {
@@ -7043,8 +7184,56 @@ const SnkApplication = class {
7043
7184
  }
7044
7185
  return this._formConfigFetcher;
7045
7186
  }
7187
+ get pesquisaFetcher() {
7188
+ if (!this._pesquisaFetcher) {
7189
+ this._pesquisaFetcher = new PesquisaFetcher();
7190
+ }
7191
+ return this._pesquisaFetcher;
7192
+ }
7193
+ executeSearch(searchArgument, fieldName, dataUnit) {
7194
+ const descriptor = dataUnit.getField(fieldName);
7195
+ if (!descriptor) ;
7196
+ else {
7197
+ const { mode, argument } = searchArgument;
7198
+ const { ENTITYNAME } = descriptor.properties;
7199
+ const dependencies = descriptor.dependencies;
7200
+ let criteria;
7201
+ dependencies === null || dependencies === void 0 ? void 0 : dependencies.forEach(dependency => {
7202
+ var _a;
7203
+ if (dependency.type === DependencyType.SEARCHING) {
7204
+ if (((_a = dependency.masterFields) === null || _a === void 0 ? void 0 : _a.length) > 0) {
7205
+ criteria = {
7206
+ expression: dependency.expression,
7207
+ params: dependency.masterFields.map(fieldName => {
7208
+ const masterDescriptor = dataUnit.getField(fieldName);
7209
+ const dataType = (masterDescriptor === null || masterDescriptor === void 0 ? void 0 : masterDescriptor.dataType) || DataType.TEXT;
7210
+ return { name: fieldName, value: dataUnit.getFieldValue(fieldName), dataType };
7211
+ })
7212
+ };
7213
+ }
7214
+ }
7215
+ });
7216
+ if (mode === "ADVANCED") {
7217
+ return new Promise(accept => {
7218
+ const pesquisaContent = document.createElement("snk-pesquisa");
7219
+ pesquisaContent.argument = argument;
7220
+ pesquisaContent.searchLoader = (text) => this.pesquisaFetcher.loadAdvancedSearch(ENTITYNAME, text, criteria);
7221
+ pesquisaContent.onSelectItem = (option) => {
7222
+ accept(option);
7223
+ this.closePopUp();
7224
+ };
7225
+ this.showPopUp(pesquisaContent);
7226
+ });
7227
+ }
7228
+ else {
7229
+ return this.pesquisaFetcher.loadSearchOptions(ENTITYNAME, argument, criteria);
7230
+ }
7231
+ }
7232
+ }
7046
7233
  componentWillLoad() {
7047
- ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", pesquisaLoadOptions);
7234
+ ApplicationContext.setContextValue("__EZUI__SEARCH__OPTION__LOADER__", (searchArgument, fieldName, dataUnit) => {
7235
+ return this.executeSearch(searchArgument, fieldName, dataUnit);
7236
+ });
7048
7237
  }
7049
7238
  componentDidLoad() {
7050
7239
  this.applicationLoading.emit(true);
@@ -7053,7 +7242,7 @@ const SnkApplication = class {
7053
7242
  });
7054
7243
  }
7055
7244
  render() {
7056
- return (h("div", null));
7245
+ return (h("div", null, h("ez-popup", { opened: false, ref: (ref) => this._popUp = ref, onEzClosePopup: () => this.closePopUp() })));
7057
7246
  }
7058
7247
  };
7059
7248
  SnkApplication.style = snkApplicationCss;
@@ -0,0 +1,15 @@
1
+ import { r as registerInstance, h, H as Host } from './index-427447f8.js';
2
+
3
+ const snkPesquisaCss = ":host{display:block}";
4
+
5
+ const SnkPesquisa = class {
6
+ constructor(hostRef) {
7
+ registerInstance(this, hostRef);
8
+ }
9
+ render() {
10
+ return (h(Host, null, h("ez-text-input", { ref: ref => this._textInput = ref, value: this.argument }), h("button", { onClick: () => this.searchLoader(this._textInput["value"]) }, "pesquisar"), h("button", { onClick: () => this.onSelectItem({ value: "10", label: "Zé das couves" }) }, "selecionar")));
11
+ }
12
+ };
13
+ SnkPesquisa.style = snkPesquisaCss;
14
+
15
+ export { SnkPesquisa as snk_pesquisa };
@@ -0,0 +1,33 @@
1
+ import { r as registerInstance, h } from './index-427447f8.js';
2
+ import { DataUnit, DataType, UserInterface } from '@sankhyalabs/core';
3
+
4
+ const testePesquisaCss = ":host{display:block}";
5
+
6
+ const TestePesquisa = class {
7
+ constructor(hostRef) {
8
+ registerInstance(this, hostRef);
9
+ }
10
+ componentWillLoad() {
11
+ this.dataUnit = new DataUnit("testes_com_formulario");
12
+ this.dataUnit.metadata = {
13
+ name: "dd://br.com.sankhya.fin.cad.movimentacaoFinanceira/Financeiro",
14
+ label: "Parceiro",
15
+ fields: [
16
+ {
17
+ name: "CODPARC",
18
+ label: "Parceiro",
19
+ dataType: DataType.NUMBER,
20
+ userInterface: UserInterface.SEARCH,
21
+ required: true,
22
+ properties: { ENTITYNAME: "Parceiro" }
23
+ }
24
+ ]
25
+ };
26
+ }
27
+ render() {
28
+ return (h("snk-application", null, h("ez-form", { dataUnit: this.dataUnit })));
29
+ }
30
+ };
31
+ TestePesquisa.style = testePesquisaCss;
32
+
33
+ export { TestePesquisa as teste_pesquisa };