@sankhyalabs/sankhyablocks 2.1.0 → 2.1.2

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 (35) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/sankhyablocks.cjs.js +1 -1
  3. package/dist/cjs/snk-application.cjs.entry.js +38 -0
  4. package/dist/cjs/snk-crud.cjs.entry.js +5 -1
  5. package/dist/cjs/snk-field-config_2.cjs.entry.js +1 -1
  6. package/dist/cjs/snk-form.cjs.entry.js +60 -22
  7. package/dist/collection/components/snk-application/snk-application.js +57 -0
  8. package/dist/collection/components/snk-crud/snk-crud.js +25 -1
  9. package/dist/collection/components/snk-form/snk-form.js +61 -23
  10. package/dist/collection/components/snk-grid/snk-grid.js +18 -1
  11. package/dist/collection/lib/http/data-fetcher/fetchers/default-values-fetcher.js +17 -0
  12. package/dist/components/snk-application2.js +40 -0
  13. package/dist/components/snk-crud.js +6 -1
  14. package/dist/components/snk-form2.js +61 -23
  15. package/dist/components/snk-grid2.js +2 -1
  16. package/dist/esm/loader.js +1 -1
  17. package/dist/esm/sankhyablocks.js +1 -1
  18. package/dist/esm/snk-application.entry.js +38 -0
  19. package/dist/esm/snk-crud.entry.js +5 -1
  20. package/dist/esm/snk-field-config_2.entry.js +1 -1
  21. package/dist/esm/snk-form.entry.js +61 -23
  22. package/dist/sankhyablocks/{p-4c887c1f.entry.js → p-599846fb.entry.js} +1 -1
  23. package/dist/sankhyablocks/{p-eb23420d.entry.js → p-6511d132.entry.js} +1 -1
  24. package/dist/sankhyablocks/p-cb8d71ba.entry.js +1 -0
  25. package/dist/sankhyablocks/p-ce7c38a1.entry.js +1 -0
  26. package/dist/sankhyablocks/sankhyablocks.esm.js +1 -1
  27. package/dist/types/components/snk-application/snk-application.d.ts +12 -0
  28. package/dist/types/components/snk-crud/snk-crud.d.ts +4 -0
  29. package/dist/types/components/snk-form/snk-form.d.ts +6 -4
  30. package/dist/types/components/snk-grid/snk-grid.d.ts +4 -0
  31. package/dist/types/components.d.ts +24 -0
  32. package/dist/types/lib/http/data-fetcher/fetchers/default-values-fetcher.d.ts +4 -0
  33. package/package.json +1 -1
  34. package/dist/sankhyablocks/p-2b891c4a.entry.js +0 -1
  35. package/dist/sankhyablocks/p-e128f747.entry.js +0 -1
@@ -14,7 +14,7 @@ const patchEsm = () => {
14
14
  const defineCustomElements = (win, options) => {
15
15
  if (typeof window === 'undefined') return Promise.resolve();
16
16
  return patchEsm().then(() => {
17
- return index.bootstrapLazy([["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"getDataUnit":[64]}]]],["snk-filter-binary-select.cjs",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-multi-select.cjs",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-number.cjs",[[0,"snk-filter-number",{"config":[16],"value":[2],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-period.cjs",[[0,"snk-filter-period",{"config":[16],"value":[8],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-personalized.cjs",[[0,"snk-filter-personalized",{"config":[16],"value":[1040],"fix":[16],"unfix":[16],"show":[64]}]]],["snk-filter-search.cjs",[[0,"snk-filter-search",{"config":[16],"value":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-text.cjs",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-config-options.cjs",[[2,"snk-config-options",{"fieldConfig":[16],"idConfig":[513,"id-config"],"dataUnit":[16],"_defaultType":[32]}]]],["snk-tab-config.cjs",[[6,"snk-tab-config",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"_processedTabs":[32],"_activeEditText":[32],"_activeEditTextIndex":[32],"_actionsHide":[32],"_actionsShow":[32]}]]],["snk-filter-detail.cjs",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16],"show":[64]}]]],["snk-field-config_2.cjs",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"taskbarManager":[16],"statusResolver":[16],"_dataUnit":[32],"_dataState":[32],"_gridConfig":[32],"setShowGridConfig":[64],"setConfig":[64]}],[2,"snk-field-config",{"isConfigActive":[16],"fieldConfig":[16],"modeInsertion":[516,"mode-insertion"],"dataUnit":[16]}]]],["snk-form-config.cjs",[[2,"snk-form-config",{"dataUnit":[16],"formConfig":[16],"parentForm":[16],"_formConfigOptions":[32],"_fieldConfigSelected":[32],"_layoutFormConfig":[32],"_fieldsAvailable":[32],"_formConfig":[32],"_formConfigChanged":[32],"_optionFormConfigSelected":[32],"_optionFormConfigChanged":[32],"_tempGroups":[32]}]]],["snk-config-modal.cjs",[[2,"snk-config-modal",{"configName":[1,"config-name"],"gridMode":[4,"grid-mode"]}]]],["snk-configurator_6.cjs",[[2,"snk-filter-bar",{"dataUnit":[1040],"configName":[1,"config-name"],"filterConfig":[1040],"allowDefault":[32]},[[0,"filterChange","filterChangeListener"]]],[6,"snk-taskbar",{"configName":[1,"config-name"],"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"detailIsVisible":[32],"showUp":[64],"hideDetail":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32],"hideDetail":[64]},[[2,"keydown","keyDownHandler"]]],[0,"snk-filter-modal",{"getMessage":[16],"items":[1040],"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"infoText":[1,"info-text"],"useSearch":[4,"use-search"],"processModalAction":[16],"_filterArgument":[32]}],[2,"snk-configurator",{"configName":[1,"config-name"],"name":[1],"enabled":[4]}]]],["snk-form.cjs",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"taskbarManager":[16],"_dataUnit":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32],"_showFormConfig":[32],"setShowFormConfig":[64],"setConfig":[64]}]]],["snk-crud.cjs",[[6,"snk-crud",{"configName":[1025,"config-name"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"_dataUnit":[32],"_dataState":[32],"goToView":[64]}]]],["snk-application.cjs",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"getUserID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"fetchUserAvailableConfigs":[64],"fetchLegacyConfig":[64],"fetchDefaultConfig":[64],"loadTotals":[64],"saveGridConfig":[64],"getFilterBarConfig":[64],"saveFilterBarConfig":[64],"saveFormConfig":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64]}]]]], options);
17
+ return index.bootstrapLazy([["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"getDataUnit":[64]}]]],["snk-filter-binary-select.cjs",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-multi-select.cjs",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-number.cjs",[[0,"snk-filter-number",{"config":[16],"value":[2],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-period.cjs",[[0,"snk-filter-period",{"config":[16],"value":[8],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-personalized.cjs",[[0,"snk-filter-personalized",{"config":[16],"value":[1040],"fix":[16],"unfix":[16],"show":[64]}]]],["snk-filter-search.cjs",[[0,"snk-filter-search",{"config":[16],"value":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-text.cjs",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-config-options.cjs",[[2,"snk-config-options",{"fieldConfig":[16],"idConfig":[513,"id-config"],"dataUnit":[16],"_defaultType":[32]}]]],["snk-tab-config.cjs",[[6,"snk-tab-config",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"_processedTabs":[32],"_activeEditText":[32],"_activeEditTextIndex":[32],"_actionsHide":[32],"_actionsShow":[32]}]]],["snk-filter-detail.cjs",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16],"show":[64]}]]],["snk-field-config_2.cjs",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"taskbarManager":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"_dataUnit":[32],"_dataState":[32],"_gridConfig":[32],"setShowGridConfig":[64],"setConfig":[64]}],[2,"snk-field-config",{"isConfigActive":[16],"fieldConfig":[16],"modeInsertion":[516,"mode-insertion"],"dataUnit":[16]}]]],["snk-form-config.cjs",[[2,"snk-form-config",{"dataUnit":[16],"formConfig":[16],"parentForm":[16],"_formConfigOptions":[32],"_fieldConfigSelected":[32],"_layoutFormConfig":[32],"_fieldsAvailable":[32],"_formConfig":[32],"_formConfigChanged":[32],"_optionFormConfigSelected":[32],"_optionFormConfigChanged":[32],"_tempGroups":[32]}]]],["snk-config-modal.cjs",[[2,"snk-config-modal",{"configName":[1,"config-name"],"gridMode":[4,"grid-mode"]}]]],["snk-configurator_6.cjs",[[2,"snk-filter-bar",{"dataUnit":[1040],"configName":[1,"config-name"],"filterConfig":[1040],"allowDefault":[32]},[[0,"filterChange","filterChangeListener"]]],[6,"snk-taskbar",{"configName":[1,"config-name"],"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"detailIsVisible":[32],"showUp":[64],"hideDetail":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32],"hideDetail":[64]},[[2,"keydown","keyDownHandler"]]],[0,"snk-filter-modal",{"getMessage":[16],"items":[1040],"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"infoText":[1,"info-text"],"useSearch":[4,"use-search"],"processModalAction":[16],"_filterArgument":[32]}],[2,"snk-configurator",{"configName":[1,"config-name"],"name":[1],"enabled":[4]}]]],["snk-form.cjs",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"taskbarManager":[16],"_dataUnit":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32],"_showFormConfig":[32],"setShowFormConfig":[64],"setConfig":[64]}]]],["snk-crud.cjs",[[6,"snk-crud",{"configName":[1025,"config-name"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"_dataUnit":[32],"_dataState":[32],"goToView":[64]}]]],["snk-application.cjs",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"getUserID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"fetchUserAvailableConfigs":[64],"fetchLegacyConfig":[64],"fetchDefaultConfig":[64],"loadTotals":[64],"saveGridConfig":[64],"getFilterBarConfig":[64],"saveFilterBarConfig":[64],"saveFormConfig":[64],"getDefaultValues":[64],"getDefaultValue":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64]}]]]], options);
18
18
  });
19
19
  };
20
20
 
@@ -15,5 +15,5 @@ const patchBrowser = () => {
15
15
  };
16
16
 
17
17
  patchBrowser().then(options => {
18
- return index.bootstrapLazy([["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"getDataUnit":[64]}]]],["snk-filter-binary-select.cjs",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-multi-select.cjs",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-number.cjs",[[0,"snk-filter-number",{"config":[16],"value":[2],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-period.cjs",[[0,"snk-filter-period",{"config":[16],"value":[8],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-personalized.cjs",[[0,"snk-filter-personalized",{"config":[16],"value":[1040],"fix":[16],"unfix":[16],"show":[64]}]]],["snk-filter-search.cjs",[[0,"snk-filter-search",{"config":[16],"value":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-text.cjs",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-config-options.cjs",[[2,"snk-config-options",{"fieldConfig":[16],"idConfig":[513,"id-config"],"dataUnit":[16],"_defaultType":[32]}]]],["snk-tab-config.cjs",[[6,"snk-tab-config",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"_processedTabs":[32],"_activeEditText":[32],"_activeEditTextIndex":[32],"_actionsHide":[32],"_actionsShow":[32]}]]],["snk-filter-detail.cjs",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16],"show":[64]}]]],["snk-field-config_2.cjs",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"taskbarManager":[16],"statusResolver":[16],"_dataUnit":[32],"_dataState":[32],"_gridConfig":[32],"setShowGridConfig":[64],"setConfig":[64]}],[2,"snk-field-config",{"isConfigActive":[16],"fieldConfig":[16],"modeInsertion":[516,"mode-insertion"],"dataUnit":[16]}]]],["snk-form-config.cjs",[[2,"snk-form-config",{"dataUnit":[16],"formConfig":[16],"parentForm":[16],"_formConfigOptions":[32],"_fieldConfigSelected":[32],"_layoutFormConfig":[32],"_fieldsAvailable":[32],"_formConfig":[32],"_formConfigChanged":[32],"_optionFormConfigSelected":[32],"_optionFormConfigChanged":[32],"_tempGroups":[32]}]]],["snk-config-modal.cjs",[[2,"snk-config-modal",{"configName":[1,"config-name"],"gridMode":[4,"grid-mode"]}]]],["snk-configurator_6.cjs",[[2,"snk-filter-bar",{"dataUnit":[1040],"configName":[1,"config-name"],"filterConfig":[1040],"allowDefault":[32]},[[0,"filterChange","filterChangeListener"]]],[6,"snk-taskbar",{"configName":[1,"config-name"],"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"detailIsVisible":[32],"showUp":[64],"hideDetail":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32],"hideDetail":[64]},[[2,"keydown","keyDownHandler"]]],[0,"snk-filter-modal",{"getMessage":[16],"items":[1040],"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"infoText":[1,"info-text"],"useSearch":[4,"use-search"],"processModalAction":[16],"_filterArgument":[32]}],[2,"snk-configurator",{"configName":[1,"config-name"],"name":[1],"enabled":[4]}]]],["snk-form.cjs",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"taskbarManager":[16],"_dataUnit":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32],"_showFormConfig":[32],"setShowFormConfig":[64],"setConfig":[64]}]]],["snk-crud.cjs",[[6,"snk-crud",{"configName":[1025,"config-name"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"_dataUnit":[32],"_dataState":[32],"goToView":[64]}]]],["snk-application.cjs",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"getUserID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"fetchUserAvailableConfigs":[64],"fetchLegacyConfig":[64],"fetchDefaultConfig":[64],"loadTotals":[64],"saveGridConfig":[64],"getFilterBarConfig":[64],"saveFilterBarConfig":[64],"saveFormConfig":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64]}]]]], options);
18
+ return index.bootstrapLazy([["teste-pesquisa.cjs",[[1,"teste-pesquisa"]]],["snk-data-unit.cjs",[[2,"snk-data-unit",{"dataState":[1040],"dataUnitName":[1,"data-unit-name"],"entityName":[1,"entity-name"],"pageSize":[2,"page-size"],"dataUnit":[1040],"beforeSave":[16],"afterSave":[16],"getDataUnit":[64]}]]],["snk-filter-binary-select.cjs",[[0,"snk-filter-binary-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-multi-select.cjs",[[0,"snk-filter-multi-select",{"value":[1544],"config":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-number.cjs",[[0,"snk-filter-number",{"config":[16],"value":[2],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-period.cjs",[[0,"snk-filter-period",{"config":[16],"value":[8],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-personalized.cjs",[[0,"snk-filter-personalized",{"config":[16],"value":[1040],"fix":[16],"unfix":[16],"show":[64]}]]],["snk-filter-search.cjs",[[0,"snk-filter-search",{"config":[16],"value":[16],"show":[64]},[[0,"ezChange","ezChangeListener"]]]]],["snk-filter-text.cjs",[[0,"snk-filter-text",{"config":[16],"value":[1]},[[0,"ezChange","ezChangeListener"]]]]],["snk-pesquisa.cjs",[[2,"snk-pesquisa",{"searchLoader":[16],"selectItem":[16],"argument":[1025],"_itemList":[32],"_startLoading":[32]}]]],["snk-config-options.cjs",[[2,"snk-config-options",{"fieldConfig":[16],"idConfig":[513,"id-config"],"dataUnit":[16],"_defaultType":[32]}]]],["snk-tab-config.cjs",[[6,"snk-tab-config",{"selectedIndex":[1538,"selected-index"],"selectedTab":[1537,"selected-tab"],"tabs":[1],"_processedTabs":[32],"_activeEditText":[32],"_activeEditTextIndex":[32],"_actionsHide":[32],"_actionsShow":[32]}]]],["snk-filter-detail.cjs",[[0,"snk-filter-detail",{"config":[1040],"getMessage":[16],"show":[64]}]]],["snk-field-config_2.cjs",[[6,"snk-grid",{"configName":[1,"config-name"],"actionsList":[16],"taskbarManager":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"_dataUnit":[32],"_dataState":[32],"_gridConfig":[32],"setShowGridConfig":[64],"setConfig":[64]}],[2,"snk-field-config",{"isConfigActive":[16],"fieldConfig":[16],"modeInsertion":[516,"mode-insertion"],"dataUnit":[16]}]]],["snk-form-config.cjs",[[2,"snk-form-config",{"dataUnit":[16],"formConfig":[16],"parentForm":[16],"_formConfigOptions":[32],"_fieldConfigSelected":[32],"_layoutFormConfig":[32],"_fieldsAvailable":[32],"_formConfig":[32],"_formConfigChanged":[32],"_optionFormConfigSelected":[32],"_optionFormConfigChanged":[32],"_tempGroups":[32]}]]],["snk-config-modal.cjs",[[2,"snk-config-modal",{"configName":[1,"config-name"],"gridMode":[4,"grid-mode"]}]]],["snk-configurator_6.cjs",[[2,"snk-filter-bar",{"dataUnit":[1040],"configName":[1,"config-name"],"filterConfig":[1040],"allowDefault":[32]},[[0,"filterChange","filterChangeListener"]]],[6,"snk-taskbar",{"configName":[1,"config-name"],"buttons":[1],"customButtons":[16],"actionsList":[16],"primaryButton":[1,"primary-button"],"disabledButtons":[16],"dataUnit":[16],"_permissions":[32]}],[0,"snk-filter-item",{"config":[1040],"getMessage":[16],"detailIsVisible":[32],"showUp":[64],"hideDetail":[64]},[[2,"click","clickListener"],[2,"mousedown","mouseDownListener"],[0,"filterChange","filterChangeListener"]]],[4,"snk-filter-list",{"label":[1],"iconName":[1,"icon-name"],"items":[16],"getMessage":[16],"emptyText":[1,"empty-text"],"findFilterText":[1,"find-filter-text"],"buttonClass":[1,"button-class"],"_filterArgument":[32],"_showAll":[32],"hideDetail":[64]},[[2,"keydown","keyDownHandler"]]],[0,"snk-filter-modal",{"getMessage":[16],"items":[1040],"modalTitle":[1,"modal-title"],"modalSubTitle":[1,"modal-sub-title"],"cancelButtonLabel":[1,"cancel-button-label"],"okButtonLabel":[1,"ok-button-label"],"infoText":[1,"info-text"],"useSearch":[4,"use-search"],"processModalAction":[16],"_filterArgument":[32]}],[2,"snk-configurator",{"configName":[1,"config-name"],"name":[1],"enabled":[4]}]]],["snk-form.cjs",[[2,"snk-form",{"configName":[1,"config-name"],"recordsValidator":[16],"actionsList":[16],"taskbarManager":[16],"_dataUnit":[32],"_dataState":[32],"_editionFormConfig":[32],"_insertionFormConfig":[32],"_showFormConfig":[32],"setShowFormConfig":[64],"setConfig":[64]}]]],["snk-crud.cjs",[[6,"snk-crud",{"configName":[1025,"config-name"],"actionsList":[16],"taskbarManager":[16],"recordsValidator":[16],"statusResolver":[16],"multipleSelection":[4,"multiple-selection"],"_dataUnit":[32],"_dataState":[32],"goToView":[64]}]]],["snk-application.cjs",[[2,"snk-application",{"messagesBuilder":[1040],"configName":[1,"config-name"],"isUserSup":[64],"hasAccess":[64],"getAllAccess":[64],"getStringParam":[64],"getIntParam":[64],"getFloatParam":[64],"getBooleanParam":[64],"getDateParam":[64],"showPopUp":[64],"showModal":[64],"closeModal":[64],"closePopUp":[64],"temOpcional":[64],"getConfig":[64],"saveConfig":[64],"getAttributeFromHTMLWrapper":[64],"openApp":[64],"createDataunit":[64],"getDataUnit":[64],"getResourceID":[64],"getUserID":[64],"alert":[64],"error":[64],"success":[64],"message":[64],"confirm":[64],"info":[64],"loadFormConfig":[64],"loadGridConfig":[64],"fetchUserAvailableConfigs":[64],"fetchLegacyConfig":[64],"fetchDefaultConfig":[64],"loadTotals":[64],"saveGridConfig":[64],"getFilterBarConfig":[64],"saveFilterBarConfig":[64],"saveFormConfig":[64],"getDefaultValues":[64],"getDefaultValue":[64],"executeSearch":[64],"executePreparedSearch":[64],"isDebugMode":[64]}]]]], options);
19
19
  });
@@ -674,6 +674,23 @@ class FilterBarConfigFetcher extends formConfigFetcher.ResourceFetcher {
674
674
  }
675
675
  }
676
676
 
677
+ class DefaultValuesFetcher extends formConfigFetcher.ResourceFetcher {
678
+ getDefaultValues(resourceID) {
679
+ return new Promise((resolve, reject) => {
680
+ this.loadResource(`cfg://defaultValues/${resourceID}`)
681
+ .then(loadedResource => {
682
+ let value;
683
+ if (loadedResource) {
684
+ value = JSON.parse(loadedResource);
685
+ }
686
+ resolve(value);
687
+ }).catch((error) => {
688
+ reject(error);
689
+ });
690
+ });
691
+ }
692
+ }
693
+
677
694
  const snkApplicationCss = ".sc-snk-application-h{display:flex;flex-direction:column;height:100%}";
678
695
 
679
696
  const SnkApplication = class {
@@ -1080,6 +1097,18 @@ const SnkApplication = class {
1080
1097
  async saveFormConfig(config, name) {
1081
1098
  return this.formConfigFetcher.saveConfig(config, name, this.resourceID);
1082
1099
  }
1100
+ /**
1101
+ * Busca um objeto com um conjunto de valores padrão.
1102
+ */
1103
+ async getDefaultValues() {
1104
+ return this.defaultValuesFetcher.getDefaultValues(this.resourceID);
1105
+ }
1106
+ /**
1107
+ * Retorna um valor padrão específico de uma expressão.
1108
+ */
1109
+ async getDefaultValue(expression) {
1110
+ return this._defaultValues && this._defaultValues[expression];
1111
+ }
1083
1112
  async getAuthList(_auth) {
1084
1113
  return await (new MGEAuthorization()).parseFromJSON(_auth);
1085
1114
  }
@@ -1131,6 +1160,12 @@ const SnkApplication = class {
1131
1160
  }
1132
1161
  return this._filterBarConfigFetcher;
1133
1162
  }
1163
+ get defaultValuesFetcher() {
1164
+ if (!this._defaultValuesFetcher) {
1165
+ this._defaultValuesFetcher = new DefaultValuesFetcher();
1166
+ }
1167
+ return this._defaultValuesFetcher;
1168
+ }
1134
1169
  async executeSearch(searchArgument, fieldName, dataUnit) {
1135
1170
  const descriptor = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(fieldName);
1136
1171
  if (!descriptor) ;
@@ -1225,6 +1260,9 @@ const SnkApplication = class {
1225
1260
  });
1226
1261
  }
1227
1262
  core.ErrorTracking.init();
1263
+ this.getDefaultValues().then((defaultValues) => {
1264
+ this._defaultValues = defaultValues;
1265
+ });
1228
1266
  }
1229
1267
  connectedCallback() {
1230
1268
  core.ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
@@ -15,6 +15,10 @@ const SnkCrud = class {
15
15
  constructor(hostRef) {
16
16
  index.registerInstance(this, hostRef);
17
17
  this.actionClick = index.createEvent(this, "actionClick", 7);
18
+ /**
19
+ * Determina se pode haver mais de uma linha selecionada na grade
20
+ */
21
+ this.multipleSelection = true;
18
22
  }
19
23
  /**
20
24
  * Usado para alternar a visão entre GRID e FORM externamente.
@@ -69,7 +73,7 @@ const SnkCrud = class {
69
73
  }
70
74
  }
71
75
  render() {
72
- return (index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-configurator-parent": "snkConfigurator" }, index.h("stack-item", null, index.h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList, statusResolver: this.statusResolver }, index.h("slot", { name: "SnkGridHeader" }), index.h("slot", { name: "SnkGridFooter" }), index.h("slot", { name: "SnkGridTaskBar" }))), index.h("stack-item", null, index.h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE.index), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, index.h("slot", { name: "SnkFormTaskBar" })))));
76
+ return (index.h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-configurator-parent": "snkConfigurator" }, index.h("stack-item", null, index.h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, index.h("slot", { name: "SnkGridHeader" }), index.h("slot", { name: "SnkGridFooter" }), index.h("slot", { name: "SnkGridTaskBar" }))), index.h("stack-item", null, index.h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE.index), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, index.h("slot", { name: "SnkFormTaskBar" })))));
73
77
  }
74
78
  get _element() { return index.getElement(this); }
75
79
  };
@@ -130,7 +130,7 @@ const SnkGrid = class {
130
130
  if (!this._dataUnit) {
131
131
  return undefined;
132
132
  }
133
- return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, index.h("snk-filter-bar", { dataUnit: this._dataUnit, class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), index.h("snk-taskbar", { class: "ez-padding-left--medium", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), index.h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.changeConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver }, index.h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" }))));
133
+ return (index.h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, index.h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, index.h("snk-filter-bar", { dataUnit: this._dataUnit, class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), index.h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), index.h("snk-taskbar", { class: "ez-padding-left--medium", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), index.h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.changeConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, index.h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), index.h("div", { class: "ez-col ez-col--sd-12" }, index.h("slot", { name: "SnkGridFooter" }))));
134
134
  }
135
135
  get _element() { return index.getElement(this); }
136
136
  };
@@ -35,38 +35,55 @@ const SnkForm = class {
35
35
  */
36
36
  async setConfig(config) {
37
37
  this._editionFormConfig = {};
38
- setTimeout(() => {
39
- this._editionFormConfig = config != undefined ? config : {};
38
+ if (!this.loadConfig(config)) {
40
39
  this.loadInsertionConfig();
41
- }, this._renderTimer);
42
- }
43
- getFormConfig() {
44
- return (this._dataState && this._dataState.insertionMode ? this._insertionFormConfig : this._editionFormConfig);
45
- }
46
- exitForm() {
47
- if (this._dataUnit.isDirty()) {
48
- this._dataUnit.cancelEdition({ after: () => this.exit.emit() });
49
- }
50
- else {
51
- this.exit.emit();
52
40
  }
53
41
  }
54
- getDisabledButtons() {
55
- const disabled = [];
56
- if (!this._dataState.hasPrevious) {
57
- disabled.push("PREVIOUS");
42
+ loadConfig(config) {
43
+ if ((config === null || config === void 0 ? void 0 : config.fields) == undefined) {
44
+ return false;
58
45
  }
59
- if (!this._dataState.hasNext) {
60
- disabled.push("NEXT");
46
+ setTimeout(async () => {
47
+ for (const field of config.fields) {
48
+ if (field.defaultValue && "value" in field.defaultValue) {
49
+ const value = field.defaultValue.value;
50
+ await this.getFormattedValue(value)
51
+ .then((formattedValue) => {
52
+ field.defaultValue.formattedValue = formattedValue;
53
+ });
54
+ }
55
+ }
56
+ this._editionFormConfig = config;
57
+ this.loadInsertionConfig();
58
+ }, this._renderTimer);
59
+ return true;
60
+ }
61
+ async getFormattedValue(value) {
62
+ switch (value) {
63
+ case "${data}":
64
+ return () => core.DateUtils.getToday();
65
+ case "${datahora}":
66
+ return () => core.DateUtils.getToday(true);
67
+ case "${usuario}":
68
+ case "${usuario.empresa}":
69
+ case "${usuario.vendedor}":
70
+ case "${usuario.centroresultado}":
71
+ let fieldValue;
72
+ await this._application.getDefaultValue(value)
73
+ .then((defaultValue) => {
74
+ fieldValue = defaultValue;
75
+ });
76
+ return fieldValue;
77
+ default:
78
+ return value;
61
79
  }
62
- return disabled;
63
80
  }
64
81
  loadInsertionConfig() {
65
82
  var _a;
66
83
  if (this._dataUnit) {
67
84
  const copyFormConfig = core.ObjectUtils.copy(this._editionFormConfig || {});
68
- copyFormConfig.fields = (_a = copyFormConfig.fields) === null || _a === void 0 ? void 0 : _a.filter(fieldCfg => {
69
- const def = this._dataUnit.getField(fieldCfg.name);
85
+ copyFormConfig.fields = (_a = copyFormConfig.fields) === null || _a === void 0 ? void 0 : _a.filter(field => {
86
+ const def = this._dataUnit.getField(field.name);
70
87
  if (def === null || def === void 0 ? void 0 : def.readOnly) {
71
88
  return false;
72
89
  }
@@ -75,6 +92,17 @@ const SnkForm = class {
75
92
  this._insertionFormConfig = copyFormConfig;
76
93
  }
77
94
  }
95
+ getFormConfig() {
96
+ return (this._dataState && this._dataState.insertionMode ? this._insertionFormConfig : this._editionFormConfig);
97
+ }
98
+ exitForm() {
99
+ if (this._dataUnit.isDirty()) {
100
+ this._dataUnit.cancelEdition({ after: () => this.exit.emit() });
101
+ }
102
+ else {
103
+ this.exit.emit();
104
+ }
105
+ }
78
106
  /**
79
107
  * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
80
108
  * através de um pequeno modulo na estrutura da aplicação:
@@ -91,6 +119,16 @@ const SnkForm = class {
91
119
  changeConfig(config) {
92
120
  this.configChanged.emit(config);
93
121
  }
122
+ getDisabledButtons() {
123
+ const disabled = [];
124
+ if (!this._dataState.hasPrevious) {
125
+ disabled.push("PREVIOUS");
126
+ }
127
+ if (!this._dataState.hasNext) {
128
+ disabled.push("NEXT");
129
+ }
130
+ return disabled;
131
+ }
94
132
  componentDidRender() {
95
133
  configurableElementsStorage.ConfigurableElementsStorage.setForm(this.configName, this._element);
96
134
  }
@@ -16,6 +16,7 @@ import MGEAuthorization from '../../lib/auth/mgeauthorization.module';
16
16
  import GridConfigFetcher from "../../lib/http/data-fetcher/fetchers/grid-config-fetcher";
17
17
  import AuthFetcher, { AutorizationType } from "../../lib/http/data-fetcher/fetchers/auth-fetcher";
18
18
  import FilterBarConfigFetcher from "../../lib/http/data-fetcher/fetchers/filter-bar-config-fetcher";
19
+ import { DefaultValuesFetcher } from "../../lib/http/data-fetcher/fetchers/default-values-fetcher";
19
20
  /**
20
21
  * É possível customizar as mensagens dos blocos de construção através de um pequeno modulo na estrutura da aplicação:
21
22
  * - Criar um arquivo no seguinte caminho: /messages/appmessages.msg.js.
@@ -422,6 +423,18 @@ export class SnkApplication {
422
423
  async saveFormConfig(config, name) {
423
424
  return this.formConfigFetcher.saveConfig(config, name, this.resourceID);
424
425
  }
426
+ /**
427
+ * Busca um objeto com um conjunto de valores padrão.
428
+ */
429
+ async getDefaultValues() {
430
+ return this.defaultValuesFetcher.getDefaultValues(this.resourceID);
431
+ }
432
+ /**
433
+ * Retorna um valor padrão específico de uma expressão.
434
+ */
435
+ async getDefaultValue(expression) {
436
+ return this._defaultValues && this._defaultValues[expression];
437
+ }
425
438
  async getAuthList(_auth) {
426
439
  return await (new MGEAuthorization()).parseFromJSON(_auth);
427
440
  }
@@ -473,6 +486,12 @@ export class SnkApplication {
473
486
  }
474
487
  return this._filterBarConfigFetcher;
475
488
  }
489
+ get defaultValuesFetcher() {
490
+ if (!this._defaultValuesFetcher) {
491
+ this._defaultValuesFetcher = new DefaultValuesFetcher();
492
+ }
493
+ return this._defaultValuesFetcher;
494
+ }
476
495
  async executeSearch(searchArgument, fieldName, dataUnit) {
477
496
  const descriptor = dataUnit === null || dataUnit === void 0 ? void 0 : dataUnit.getField(fieldName);
478
497
  if (!descriptor) {
@@ -569,6 +588,9 @@ export class SnkApplication {
569
588
  });
570
589
  }
571
590
  ErrorTracking.init();
591
+ this.getDefaultValues().then((defaultValues) => {
592
+ this._defaultValues = defaultValues;
593
+ });
572
594
  }
573
595
  connectedCallback() {
574
596
  ApplicationContext.setContextValue("__SNK__APPLICATION__", this);
@@ -1547,6 +1569,41 @@ export class SnkApplication {
1547
1569
  "tags": []
1548
1570
  }
1549
1571
  },
1572
+ "getDefaultValues": {
1573
+ "complexType": {
1574
+ "signature": "() => Promise<string>",
1575
+ "parameters": [],
1576
+ "references": {
1577
+ "Promise": {
1578
+ "location": "global"
1579
+ }
1580
+ },
1581
+ "return": "Promise<string>"
1582
+ },
1583
+ "docs": {
1584
+ "text": "Busca um objeto com um conjunto de valores padr\u00E3o.",
1585
+ "tags": []
1586
+ }
1587
+ },
1588
+ "getDefaultValue": {
1589
+ "complexType": {
1590
+ "signature": "(expression: string) => Promise<any>",
1591
+ "parameters": [{
1592
+ "tags": [],
1593
+ "text": ""
1594
+ }],
1595
+ "references": {
1596
+ "Promise": {
1597
+ "location": "global"
1598
+ }
1599
+ },
1600
+ "return": "Promise<any>"
1601
+ },
1602
+ "docs": {
1603
+ "text": "Retorna um valor padr\u00E3o espec\u00EDfico de uma express\u00E3o.",
1604
+ "tags": []
1605
+ }
1606
+ },
1550
1607
  "executeSearch": {
1551
1608
  "complexType": {
1552
1609
  "signature": "(searchArgument: ISearchArgument, fieldName: string, dataUnit: DataUnit) => Promise<Array<IOption> | IOption>",
@@ -10,6 +10,12 @@ const FORM_MODE = VIEW_MODE.form;
10
10
  * Para conhecer os detalhes do módulo, vide os arquivos neste projeto "/src/lib/message/resources/*.msg.ts"
11
11
  */
12
12
  export class SnkCrud {
13
+ constructor() {
14
+ /**
15
+ * Determina se pode haver mais de uma linha selecionada na grade
16
+ */
17
+ this.multipleSelection = true;
18
+ }
13
19
  /**
14
20
  * Usado para alternar a visão entre GRID e FORM externamente.
15
21
  */
@@ -63,7 +69,7 @@ export class SnkCrud {
63
69
  }
64
70
  }
65
71
  render() {
66
- return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-configurator-parent": "snkConfigurator" }, h("stack-item", null, h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList, statusResolver: this.statusResolver }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE.index), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, h("slot", { name: "SnkFormTaskBar" })))));
72
+ return (h("ez-view-stack", { ref: (ref) => this._viewStack = ref, "data-configurator-parent": "snkConfigurator" }, h("stack-item", null, h("snk-grid", { configName: this.configName, onGridDoubleClick: () => this.gridToForm(true), taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail), actionsList: this.actionsList, statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, h("slot", { name: "SnkGridHeader" }), h("slot", { name: "SnkGridFooter" }), h("slot", { name: "SnkGridTaskBar" }))), h("stack-item", null, h("snk-form", { configName: this.configName, actionsList: this.actionsList, onExit: () => this._viewStack.show(GRID_MODE.index), recordsValidator: this.recordsValidator, taskbarManager: this.taskbarManager, onActionClick: evt => this.executeAction(evt.detail) }, h("slot", { name: "SnkFormTaskBar" })))));
67
73
  }
68
74
  static get is() { return "snk-crud"; }
69
75
  static get encapsulation() { return "scoped"; }
@@ -178,6 +184,24 @@ export class SnkCrud {
178
184
  "tags": [],
179
185
  "text": "Configura\u00E7\u00E3o do valor da coluna de status.\nExemplo: { \"RECDESP\": { \"-1\" : \"#BD0025\", \"1\" : \"#157A00\" } }"
180
186
  }
187
+ },
188
+ "multipleSelection": {
189
+ "type": "boolean",
190
+ "mutable": false,
191
+ "complexType": {
192
+ "original": "boolean",
193
+ "resolved": "boolean",
194
+ "references": {}
195
+ },
196
+ "required": false,
197
+ "optional": false,
198
+ "docs": {
199
+ "tags": [],
200
+ "text": "Determina se pode haver mais de uma linha selecionada na grade"
201
+ },
202
+ "attribute": "multiple-selection",
203
+ "reflect": false,
204
+ "defaultValue": "true"
181
205
  }
182
206
  };
183
207
  }
@@ -1,4 +1,4 @@
1
- import { ApplicationContext, ObjectUtils } from '@sankhyalabs/core';
1
+ import { ApplicationContext, DateUtils, ObjectUtils } from '@sankhyalabs/core';
2
2
  import { h } from '@stencil/core';
3
3
  import ConfigurableElementsStorage from '../snk-configurator/subcomponents/configModalProvider/configurableElementsStorage';
4
4
  import TaskbarProcessor from '../snk-taskbar/processor/taskbar-processor';
@@ -24,38 +24,55 @@ export class SnkForm {
24
24
  */
25
25
  async setConfig(config) {
26
26
  this._editionFormConfig = {};
27
- setTimeout(() => {
28
- this._editionFormConfig = config != undefined ? config : {};
27
+ if (!this.loadConfig(config)) {
29
28
  this.loadInsertionConfig();
30
- }, this._renderTimer);
31
- }
32
- getFormConfig() {
33
- return (this._dataState && this._dataState.insertionMode ? this._insertionFormConfig : this._editionFormConfig);
34
- }
35
- exitForm() {
36
- if (this._dataUnit.isDirty()) {
37
- this._dataUnit.cancelEdition({ after: () => this.exit.emit() });
38
- }
39
- else {
40
- this.exit.emit();
41
29
  }
42
30
  }
43
- getDisabledButtons() {
44
- const disabled = [];
45
- if (!this._dataState.hasPrevious) {
46
- disabled.push("PREVIOUS");
31
+ loadConfig(config) {
32
+ if ((config === null || config === void 0 ? void 0 : config.fields) == undefined) {
33
+ return false;
47
34
  }
48
- if (!this._dataState.hasNext) {
49
- disabled.push("NEXT");
35
+ setTimeout(async () => {
36
+ for (const field of config.fields) {
37
+ if (field.defaultValue && "value" in field.defaultValue) {
38
+ const value = field.defaultValue.value;
39
+ await this.getFormattedValue(value)
40
+ .then((formattedValue) => {
41
+ field.defaultValue.formattedValue = formattedValue;
42
+ });
43
+ }
44
+ }
45
+ this._editionFormConfig = config;
46
+ this.loadInsertionConfig();
47
+ }, this._renderTimer);
48
+ return true;
49
+ }
50
+ async getFormattedValue(value) {
51
+ switch (value) {
52
+ case "${data}":
53
+ return () => DateUtils.getToday();
54
+ case "${datahora}":
55
+ return () => DateUtils.getToday(true);
56
+ case "${usuario}":
57
+ case "${usuario.empresa}":
58
+ case "${usuario.vendedor}":
59
+ case "${usuario.centroresultado}":
60
+ let fieldValue;
61
+ await this._application.getDefaultValue(value)
62
+ .then((defaultValue) => {
63
+ fieldValue = defaultValue;
64
+ });
65
+ return fieldValue;
66
+ default:
67
+ return value;
50
68
  }
51
- return disabled;
52
69
  }
53
70
  loadInsertionConfig() {
54
71
  var _a;
55
72
  if (this._dataUnit) {
56
73
  const copyFormConfig = ObjectUtils.copy(this._editionFormConfig || {});
57
- copyFormConfig.fields = (_a = copyFormConfig.fields) === null || _a === void 0 ? void 0 : _a.filter(fieldCfg => {
58
- const def = this._dataUnit.getField(fieldCfg.name);
74
+ copyFormConfig.fields = (_a = copyFormConfig.fields) === null || _a === void 0 ? void 0 : _a.filter(field => {
75
+ const def = this._dataUnit.getField(field.name);
59
76
  if (def === null || def === void 0 ? void 0 : def.readOnly) {
60
77
  return false;
61
78
  }
@@ -64,6 +81,17 @@ export class SnkForm {
64
81
  this._insertionFormConfig = copyFormConfig;
65
82
  }
66
83
  }
84
+ getFormConfig() {
85
+ return (this._dataState && this._dataState.insertionMode ? this._insertionFormConfig : this._editionFormConfig);
86
+ }
87
+ exitForm() {
88
+ if (this._dataUnit.isDirty()) {
89
+ this._dataUnit.cancelEdition({ after: () => this.exit.emit() });
90
+ }
91
+ else {
92
+ this.exit.emit();
93
+ }
94
+ }
67
95
  /**
68
96
  * Conforme mecanismo de mensagens, é possível customizar as mensagens dos blocos de construção
69
97
  * através de um pequeno modulo na estrutura da aplicação:
@@ -80,6 +108,16 @@ export class SnkForm {
80
108
  changeConfig(config) {
81
109
  this.configChanged.emit(config);
82
110
  }
111
+ getDisabledButtons() {
112
+ const disabled = [];
113
+ if (!this._dataState.hasPrevious) {
114
+ disabled.push("PREVIOUS");
115
+ }
116
+ if (!this._dataState.hasNext) {
117
+ disabled.push("NEXT");
118
+ }
119
+ return disabled;
120
+ }
83
121
  componentDidRender() {
84
122
  ConfigurableElementsStorage.setForm(this.configName, this._element);
85
123
  }
@@ -65,7 +65,7 @@ export class SnkGrid {
65
65
  if (!this._dataUnit) {
66
66
  return undefined;
67
67
  }
68
- return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, h("snk-filter-bar", { dataUnit: this._dataUnit, class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.changeConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver }, h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" }))));
68
+ return (h("div", { class: "snk-grid__container ez-flex ez-flex--column ez-flex-item--auto ez-padding--large" }, h("div", { class: "snk-grid__header ez-padding-bottom--medium ez-margin-bottom--medium" }, h("snk-filter-bar", { dataUnit: this._dataUnit, class: "snk-grid__filter-bar ez-align--top", configName: this.configName }), h("hr", { class: "ez-divider-vertical ez-divider--dark ez-margin-left--medium snk-grid__header-divider" }), h("snk-taskbar", { class: "ez-padding-left--medium", key: "topTaskbar", configName: this.configName, dataUnit: this._dataUnit, buttons: this._topTaskbarProcessor.buttons, disabledButtons: this._topTaskbarProcessor.disabledButtons, customButtons: this._topTaskbarProcessor.customButtons, primaryButton: "INSERT" })), h("ez-grid", { ref: ref => this._grid = ref, dataUnit: this._dataUnit, key: "grid-" + this._snkDataUnit.entityName, config: this._gridConfig, onConfigChange: (evt) => { this.changeConfig(evt.detail); }, onEzDoubleClick: () => this.gridDoubleClick.emit(), statusResolver: this.statusResolver, multipleSelection: this.multipleSelection }, h("snk-taskbar", { dataUnit: this._dataUnit, buttons: this._headerTaskbarProcessor.buttons, disabledButtons: this._headerTaskbarProcessor.disabledButtons, customButtons: this._headerTaskbarProcessor.customButtons, slot: "leftButtons", actionsList: this.actionsList })), h("div", { class: "ez-col ez-col--sd-12" }, h("slot", { name: "SnkGridFooter" }))));
69
69
  }
70
70
  static get is() { return "snk-grid"; }
71
71
  static get encapsulation() { return "scoped"; }
@@ -160,6 +160,23 @@ export class SnkGrid {
160
160
  "tags": [],
161
161
  "text": "Configura\u00E7\u00E3o do valor da coluna de status.\nExemplo: { \"RECDESP\": { \"-1\" : \"#BD0025\", \"1\" : \"#157A00\" } }"
162
162
  }
163
+ },
164
+ "multipleSelection": {
165
+ "type": "boolean",
166
+ "mutable": false,
167
+ "complexType": {
168
+ "original": "boolean",
169
+ "resolved": "boolean",
170
+ "references": {}
171
+ },
172
+ "required": false,
173
+ "optional": false,
174
+ "docs": {
175
+ "tags": [],
176
+ "text": "Determina se pode haver mais de uma linha selecionada"
177
+ },
178
+ "attribute": "multiple-selection",
179
+ "reflect": false
163
180
  }
164
181
  };
165
182
  }
@@ -0,0 +1,17 @@
1
+ import { ResourceFetcher } from "./resource-fetcher";
2
+ export class DefaultValuesFetcher extends ResourceFetcher {
3
+ getDefaultValues(resourceID) {
4
+ return new Promise((resolve, reject) => {
5
+ this.loadResource(`cfg://defaultValues/${resourceID}`)
6
+ .then(loadedResource => {
7
+ let value;
8
+ if (loadedResource) {
9
+ value = JSON.parse(loadedResource);
10
+ }
11
+ resolve(value);
12
+ }).catch((error) => {
13
+ reject(error);
14
+ });
15
+ });
16
+ }
17
+ }