@things-factory/meta-ui 9.0.0-beta.27 → 9.0.0-beta.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist-client/bootstrap.d.ts +7 -0
- package/dist-client/bootstrap.js +142 -0
- package/dist-client/bootstrap.js.map +1 -0
- package/dist-client/component/filter/filter-form-meta-code-select.d.ts +4 -0
- package/dist-client/component/filter/filter-form-meta-code-select.js +80 -0
- package/dist-client/component/filter/filter-form-meta-code-select.js.map +1 -0
- package/dist-client/component/filter/filter-form-meta-object-select.d.ts +4 -0
- package/dist-client/component/filter/filter-form-meta-object-select.js +82 -0
- package/dist-client/component/filter/filter-form-meta-object-select.js.map +1 -0
- package/dist-client/component/filter/filter-grist-meta-code-select.d.ts +3 -0
- package/dist-client/component/filter/filter-grist-meta-code-select.js +76 -0
- package/dist-client/component/filter/filter-grist-meta-code-select.js.map +1 -0
- package/dist-client/component/filter/filter-grist-meta-object-select.d.ts +3 -0
- package/dist-client/component/filter/filter-grist-meta-object-select.js +81 -0
- package/dist-client/component/filter/filter-grist-meta-object-select.js.map +1 -0
- package/dist-client/component/grist/editor/grist-editor-code-input.d.ts +15 -0
- package/dist-client/component/grist/editor/grist-editor-code-input.js +81 -0
- package/dist-client/component/grist/editor/grist-editor-code-input.js.map +1 -0
- package/dist-client/component/grist/editor/grist-editor-meta-code-selector.d.ts +15 -0
- package/dist-client/component/grist/editor/grist-editor-meta-code-selector.js +130 -0
- package/dist-client/component/grist/editor/grist-editor-meta-code-selector.js.map +1 -0
- package/dist-client/component/grist/editor/grist-editor-meta-object-selector.d.ts +15 -0
- package/dist-client/component/grist/editor/grist-editor-meta-object-selector.js +98 -0
- package/dist-client/component/grist/editor/grist-editor-meta-object-selector.js.map +1 -0
- package/dist-client/component/grist/renderer/grist-renderer-code-input.d.ts +1 -0
- package/dist-client/component/grist/renderer/grist-renderer-code-input.js +19 -0
- package/dist-client/component/grist/renderer/grist-renderer-code-input.js.map +1 -0
- package/dist-client/component/grist/renderer/grist-renderer-meta-code-selector.d.ts +1 -0
- package/dist-client/component/grist/renderer/grist-renderer-meta-code-selector.js +29 -0
- package/dist-client/component/grist/renderer/grist-renderer-meta-code-selector.js.map +1 -0
- package/dist-client/component/grist/renderer/grist-renderer-meta-object-selector.d.ts +1 -0
- package/dist-client/component/grist/renderer/grist-renderer-meta-object-selector.js +23 -0
- package/dist-client/component/grist/renderer/grist-renderer-meta-object-selector.js.map +1 -0
- package/dist-client/component/popup/code-input-editor-popup.d.ts +36 -0
- package/dist-client/component/popup/code-input-editor-popup.js +103 -0
- package/dist-client/component/popup/code-input-editor-popup.js.map +1 -0
- package/dist-client/component/popup/file-upload-popup.d.ts +1 -0
- package/dist-client/component/popup/file-upload-popup.js +118 -0
- package/dist-client/component/popup/file-upload-popup.js.map +1 -0
- package/dist-client/component/popup/meta-object-selector-popup.d.ts +60 -0
- package/dist-client/component/popup/meta-object-selector-popup.js +300 -0
- package/dist-client/component/popup/meta-object-selector-popup.js.map +1 -0
- package/dist-client/component/popup/record-based-code-editor-popup.d.ts +52 -0
- package/dist-client/component/popup/record-based-code-editor-popup.js +174 -0
- package/dist-client/component/popup/record-based-code-editor-popup.js.map +1 -0
- package/dist-client/dynamic-menus.d.ts +1 -0
- package/dist-client/dynamic-menus.js +16 -0
- package/dist-client/dynamic-menus.js.map +1 -0
- package/dist-client/index.d.ts +17 -0
- package/dist-client/index.js +18 -0
- package/dist-client/index.js.map +1 -0
- package/dist-client/load-components.d.ts +15 -0
- package/dist-client/load-components.js +17 -0
- package/dist-client/load-components.js.map +1 -0
- package/dist-client/mixin/meta-base-mixin.d.ts +89 -0
- package/dist-client/mixin/meta-base-mixin.js +287 -0
- package/dist-client/mixin/meta-base-mixin.js.map +1 -0
- package/dist-client/mixin/meta-basic-grist-mixin.d.ts +108 -0
- package/dist-client/mixin/meta-basic-grist-mixin.js +253 -0
- package/dist-client/mixin/meta-basic-grist-mixin.js.map +1 -0
- package/dist-client/mixin/meta-button-mixin.d.ts +106 -0
- package/dist-client/mixin/meta-button-mixin.js +106 -0
- package/dist-client/mixin/meta-button-mixin.js.map +1 -0
- package/dist-client/mixin/meta-form-mixin.d.ts +153 -0
- package/dist-client/mixin/meta-form-mixin.js +373 -0
- package/dist-client/mixin/meta-form-mixin.js.map +1 -0
- package/dist-client/mixin/meta-grist-tab-mixin.d.ts +132 -0
- package/dist-client/mixin/meta-grist-tab-mixin.js +301 -0
- package/dist-client/mixin/meta-grist-tab-mixin.js.map +1 -0
- package/dist-client/mixin/meta-main-tab-mixin.d.ts +109 -0
- package/dist-client/mixin/meta-main-tab-mixin.js +242 -0
- package/dist-client/mixin/meta-main-tab-mixin.js.map +1 -0
- package/dist-client/mixin/meta-master-detail-mixin.d.ts +172 -0
- package/dist-client/mixin/meta-master-detail-mixin.js +359 -0
- package/dist-client/mixin/meta-master-detail-mixin.js.map +1 -0
- package/dist-client/mixin/meta-service-mixin.d.ts +66 -0
- package/dist-client/mixin/meta-service-mixin.js +268 -0
- package/dist-client/mixin/meta-service-mixin.js.map +1 -0
- package/dist-client/mixin/meta-tab-detail-mixin.d.ts +110 -0
- package/dist-client/mixin/meta-tab-detail-mixin.js +255 -0
- package/dist-client/mixin/meta-tab-detail-mixin.js.map +1 -0
- package/dist-client/mixin/meta-tab-mixin.d.ts +108 -0
- package/dist-client/mixin/meta-tab-mixin.js +168 -0
- package/dist-client/mixin/meta-tab-mixin.js.map +1 -0
- package/dist-client/pages/activity/meta-activity-define-page.d.ts +1 -0
- package/dist-client/pages/activity/meta-activity-define-page.js +398 -0
- package/dist-client/pages/activity/meta-activity-define-page.js.map +1 -0
- package/dist-client/pages/activity/meta-activity-list-page.d.ts +1 -0
- package/dist-client/pages/activity/meta-activity-list-page.js +223 -0
- package/dist-client/pages/activity/meta-activity-list-page.js.map +1 -0
- package/dist-client/pages/activity/meta-activity-viewer-element.d.ts +25 -0
- package/dist-client/pages/activity/meta-activity-viewer-element.js +29 -0
- package/dist-client/pages/activity/meta-activity-viewer-element.js.map +1 -0
- package/dist-client/pages/activity/meta-activity-writer-element.d.ts +27 -0
- package/dist-client/pages/activity/meta-activity-writer-element.js +38 -0
- package/dist-client/pages/activity/meta-activity-writer-element.js.map +1 -0
- package/dist-client/pages/activity/meta-activiy-mixin.d.ts +17 -0
- package/dist-client/pages/activity/meta-activiy-mixin.js +70 -0
- package/dist-client/pages/activity/meta-activiy-mixin.js.map +1 -0
- package/dist-client/pages/button-role/button-role-detail.d.ts +74 -0
- package/dist-client/pages/button-role/button-role-detail.js +39 -0
- package/dist-client/pages/button-role/button-role-detail.js.map +1 -0
- package/dist-client/pages/button-role/button-role-page.d.ts +82 -0
- package/dist-client/pages/button-role/button-role-page.js +21 -0
- package/dist-client/pages/button-role/button-role-page.js.map +1 -0
- package/dist-client/pages/doc-number/doc-number-page.d.ts +1 -0
- package/dist-client/pages/doc-number/doc-number-page.js +20 -0
- package/dist-client/pages/doc-number/doc-number-page.js.map +1 -0
- package/dist-client/pages/doc-number/next-doc-number-popup.d.ts +1 -0
- package/dist-client/pages/doc-number/next-doc-number-popup.js +21 -0
- package/dist-client/pages/doc-number/next-doc-number-popup.js.map +1 -0
- package/dist-client/pages/entity/config-entity.d.ts +1 -0
- package/dist-client/pages/entity/config-entity.js +801 -0
- package/dist-client/pages/entity/config-entity.js.map +1 -0
- package/dist-client/pages/entity/main-menu-selector.d.ts +61 -0
- package/dist-client/pages/entity/main-menu-selector.js +233 -0
- package/dist-client/pages/entity/main-menu-selector.js.map +1 -0
- package/dist-client/pages/history/history-copy-list-popup.d.ts +50 -0
- package/dist-client/pages/history/history-copy-list-popup.js +122 -0
- package/dist-client/pages/history/history-copy-list-popup.js.map +1 -0
- package/dist-client/pages/history/history-json-list-popup.d.ts +50 -0
- package/dist-client/pages/history/history-json-list-popup.js +132 -0
- package/dist-client/pages/history/history-json-list-popup.js.map +1 -0
- package/dist-client/pages/menu/dynamic-menu-template.d.ts +1 -0
- package/dist-client/pages/menu/dynamic-menu-template.js +80 -0
- package/dist-client/pages/menu/dynamic-menu-template.js.map +1 -0
- package/dist-client/pages/menu/dynamic-menu.d.ts +83 -0
- package/dist-client/pages/menu/dynamic-menu.js +663 -0
- package/dist-client/pages/menu/dynamic-menu.js.map +1 -0
- package/dist-client/pages/menu/export-menu-popup.d.ts +55 -0
- package/dist-client/pages/menu/export-menu-popup.js +392 -0
- package/dist-client/pages/menu/export-menu-popup.js.map +1 -0
- package/dist-client/pages/meta-form-element.d.ts +63 -0
- package/dist-client/pages/meta-form-element.js +8 -0
- package/dist-client/pages/meta-form-element.js.map +1 -0
- package/dist-client/pages/meta-grist-element.d.ts +70 -0
- package/dist-client/pages/meta-grist-element.js +11 -0
- package/dist-client/pages/meta-grist-element.js.map +1 -0
- package/dist-client/pages/meta-grist-page.d.ts +70 -0
- package/dist-client/pages/meta-grist-page.js +14 -0
- package/dist-client/pages/meta-grist-page.js.map +1 -0
- package/dist-client/pages/meta-grist-tab-element.d.ts +82 -0
- package/dist-client/pages/meta-grist-tab-element.js +14 -0
- package/dist-client/pages/meta-grist-tab-element.js.map +1 -0
- package/dist-client/pages/meta-grist-tab-page.d.ts +82 -0
- package/dist-client/pages/meta-grist-tab-page.js +14 -0
- package/dist-client/pages/meta-grist-tab-page.js.map +1 -0
- package/dist-client/pages/meta-main-tab-element.d.ts +75 -0
- package/dist-client/pages/meta-main-tab-element.js +11 -0
- package/dist-client/pages/meta-main-tab-element.js.map +1 -0
- package/dist-client/pages/meta-main-tab-page.d.ts +75 -0
- package/dist-client/pages/meta-main-tab-page.js +14 -0
- package/dist-client/pages/meta-main-tab-page.js.map +1 -0
- package/dist-client/pages/meta-master-detail-element.d.ts +80 -0
- package/dist-client/pages/meta-master-detail-element.js +11 -0
- package/dist-client/pages/meta-master-detail-element.js.map +1 -0
- package/dist-client/pages/meta-master-detail-page.d.ts +80 -0
- package/dist-client/pages/meta-master-detail-page.js +14 -0
- package/dist-client/pages/meta-master-detail-page.js.map +1 -0
- package/dist-client/pages/meta-tab-detail-element.d.ts +76 -0
- package/dist-client/pages/meta-tab-detail-element.js +11 -0
- package/dist-client/pages/meta-tab-detail-element.js.map +1 -0
- package/dist-client/pages/meta-tab-detail-page.d.ts +76 -0
- package/dist-client/pages/meta-tab-detail-page.js +14 -0
- package/dist-client/pages/meta-tab-detail-page.js.map +1 -0
- package/dist-client/pages/meta-tab-element.d.ts +57 -0
- package/dist-client/pages/meta-tab-element.js +13 -0
- package/dist-client/pages/meta-tab-element.js.map +1 -0
- package/dist-client/pages/printer-device/printer-device-page.d.ts +1 -0
- package/dist-client/pages/printer-device/printer-device-page.js +20 -0
- package/dist-client/pages/printer-device/printer-device-page.js.map +1 -0
- package/dist-client/pages/template/doc-template-page.d.ts +1 -0
- package/dist-client/pages/template/doc-template-page.js +20 -0
- package/dist-client/pages/template/doc-template-page.js.map +1 -0
- package/dist-client/pages/template/template-file-page.d.ts +1 -0
- package/dist-client/pages/template/template-file-page.js +20 -0
- package/dist-client/pages/template/template-file-page.js.map +1 -0
- package/dist-client/pages/terms/config-terminology.d.ts +1 -0
- package/dist-client/pages/terms/config-terminology.js +188 -0
- package/dist-client/pages/terms/config-terminology.js.map +1 -0
- package/dist-client/pages/work-code/work-code-detail-popup.d.ts +69 -0
- package/dist-client/pages/work-code/work-code-detail-popup.js +13 -0
- package/dist-client/pages/work-code/work-code-detail-popup.js.map +1 -0
- package/dist-client/pages/work-code/work-code-page.d.ts +1 -0
- package/dist-client/pages/work-code/work-code-page.js +19 -0
- package/dist-client/pages/work-code/work-code-page.js.map +1 -0
- package/dist-client/route.d.ts +1 -0
- package/dist-client/route.js +30 -0
- package/dist-client/route.js.map +1 -0
- package/dist-client/tsconfig.tsbuildinfo +1 -0
- package/dist-client/utils/grist-default-value.d.ts +8 -0
- package/dist-client/utils/grist-default-value.js +33 -0
- package/dist-client/utils/grist-default-value.js.map +1 -0
- package/dist-client/utils/meta-api.d.ts +572 -0
- package/dist-client/utils/meta-api.js +728 -0
- package/dist-client/utils/meta-api.js.map +1 -0
- package/dist-client/utils/meta-crypto.d.ts +4 -0
- package/dist-client/utils/meta-crypto.js +45 -0
- package/dist-client/utils/meta-crypto.js.map +1 -0
- package/dist-client/utils/meta-ui-util.d.ts +566 -0
- package/dist-client/utils/meta-ui-util.js +2985 -0
- package/dist-client/utils/meta-ui-util.js.map +1 -0
- package/dist-client/utils/rest-service-util.d.ts +120 -0
- package/dist-client/utils/rest-service-util.js +291 -0
- package/dist-client/utils/rest-service-util.js.map +1 -0
- package/dist-client/utils/service-util.d.ts +286 -0
- package/dist-client/utils/service-util.js +1204 -0
- package/dist-client/utils/service-util.js.map +1 -0
- package/dist-client/utils/terms-util.d.ts +81 -0
- package/dist-client/utils/terms-util.js +105 -0
- package/dist-client/utils/terms-util.js.map +1 -0
- package/dist-client/utils/ui-util.d.ts +153 -0
- package/dist-client/utils/ui-util.js +307 -0
- package/dist-client/utils/ui-util.js.map +1 -0
- package/dist-client/utils/value-util.d.ts +99 -0
- package/dist-client/utils/value-util.js +214 -0
- package/dist-client/utils/value-util.js.map +1 -0
- package/dist-server/activity/CommonActivity.d.ts +2 -0
- package/dist-server/activity/CommonActivity.js +58 -0
- package/dist-server/activity/CommonActivity.js.map +1 -0
- package/dist-server/index.d.ts +2 -0
- package/dist-server/index.js +6 -0
- package/dist-server/index.js.map +1 -0
- package/dist-server/routes.d.ts +1 -0
- package/dist-server/routes.js +58 -0
- package/dist-server/routes.js.map +1 -0
- package/dist-server/service/button-role/button-role-mutation.d.ts +9 -0
- package/dist-server/service/button-role/button-role-mutation.js +112 -0
- package/dist-server/service/button-role/button-role-mutation.js.map +1 -0
- package/dist-server/service/button-role/button-role-query.d.ts +11 -0
- package/dist-server/service/button-role/button-role-query.js +79 -0
- package/dist-server/service/button-role/button-role-query.js.map +1 -0
- package/dist-server/service/button-role/button-role-type.d.ts +15 -0
- package/dist-server/service/button-role/button-role-type.js +57 -0
- package/dist-server/service/button-role/button-role-type.js.map +1 -0
- package/dist-server/service/button-role/button-role.d.ts +15 -0
- package/dist-server/service/button-role/button-role.js +69 -0
- package/dist-server/service/button-role/button-role.js.map +1 -0
- package/dist-server/service/button-role/index.d.ts +5 -0
- package/dist-server/service/button-role/index.js +9 -0
- package/dist-server/service/button-role/index.js.map +1 -0
- package/dist-server/service/dynamic-menu/dynamic-menu-query.d.ts +11 -0
- package/dist-server/service/dynamic-menu/dynamic-menu-query.js +244 -0
- package/dist-server/service/dynamic-menu/dynamic-menu-query.js.map +1 -0
- package/dist-server/service/dynamic-menu/dynamic-menu-type.d.ts +30 -0
- package/dist-server/service/dynamic-menu/dynamic-menu-type.js +109 -0
- package/dist-server/service/dynamic-menu/dynamic-menu-type.js.map +1 -0
- package/dist-server/service/dynamic-menu/index.d.ts +2 -0
- package/dist-server/service/dynamic-menu/index.js +6 -0
- package/dist-server/service/dynamic-menu/index.js.map +1 -0
- package/dist-server/service/entity-event-subscriber/entity-event-subscriber.d.ts +6 -0
- package/dist-server/service/entity-event-subscriber/entity-event-subscriber.js +71 -0
- package/dist-server/service/entity-event-subscriber/entity-event-subscriber.js.map +1 -0
- package/dist-server/service/entity-event-subscriber/index.d.ts +2 -0
- package/dist-server/service/entity-event-subscriber/index.js +6 -0
- package/dist-server/service/entity-event-subscriber/index.js.map +1 -0
- package/dist-server/service/index.d.ts +9 -0
- package/dist-server/service/index.js +42 -0
- package/dist-server/service/index.js.map +1 -0
- package/dist-server/service/menu-button-auth/index.d.ts +5 -0
- package/dist-server/service/menu-button-auth/index.js +9 -0
- package/dist-server/service/menu-button-auth/index.js.map +1 -0
- package/dist-server/service/menu-button-auth/menu-button-auth-mutation.d.ts +10 -0
- package/dist-server/service/menu-button-auth/menu-button-auth-mutation.js +127 -0
- package/dist-server/service/menu-button-auth/menu-button-auth-mutation.js.map +1 -0
- package/dist-server/service/menu-button-auth/menu-button-auth-query.d.ts +16 -0
- package/dist-server/service/menu-button-auth/menu-button-auth-query.js +167 -0
- package/dist-server/service/menu-button-auth/menu-button-auth-query.js.map +1 -0
- package/dist-server/service/menu-button-auth/menu-button-auth-type.d.ts +24 -0
- package/dist-server/service/menu-button-auth/menu-button-auth-type.js +90 -0
- package/dist-server/service/menu-button-auth/menu-button-auth-type.js.map +1 -0
- package/dist-server/service/menu-button-auth/menu-button-auth.d.ts +23 -0
- package/dist-server/service/menu-button-auth/menu-button-auth.js +102 -0
- package/dist-server/service/menu-button-auth/menu-button-auth.js.map +1 -0
- package/dist-server/service/meta-activity/index.d.ts +3 -0
- package/dist-server/service/meta-activity/index.js +7 -0
- package/dist-server/service/meta-activity/index.js.map +1 -0
- package/dist-server/service/meta-activity/meta-activity-mutation.d.ts +18 -0
- package/dist-server/service/meta-activity/meta-activity-mutation.js +183 -0
- package/dist-server/service/meta-activity/meta-activity-mutation.js.map +1 -0
- package/dist-server/service/meta-activity/meta-activity-query.d.ts +10 -0
- package/dist-server/service/meta-activity/meta-activity-query.js +66 -0
- package/dist-server/service/meta-activity/meta-activity-query.js.map +1 -0
- package/dist-server/service/meta-activity/meta-activity-type.d.ts +21 -0
- package/dist-server/service/meta-activity/meta-activity-type.js +80 -0
- package/dist-server/service/meta-activity/meta-activity-type.js.map +1 -0
- package/dist-server/service/set-translations/index.d.ts +2 -0
- package/dist-server/service/set-translations/index.js +6 -0
- package/dist-server/service/set-translations/index.js.map +1 -0
- package/dist-server/service/set-translations/set-translation-resolver.d.ts +4 -0
- package/dist-server/service/set-translations/set-translation-resolver.js +67 -0
- package/dist-server/service/set-translations/set-translation-resolver.js.map +1 -0
- package/dist-server/service/work-code/index.d.ts +5 -0
- package/dist-server/service/work-code/index.js +9 -0
- package/dist-server/service/work-code/index.js.map +1 -0
- package/dist-server/service/work-code/work-code-mutation.d.ts +10 -0
- package/dist-server/service/work-code/work-code-mutation.js +136 -0
- package/dist-server/service/work-code/work-code-mutation.js.map +1 -0
- package/dist-server/service/work-code/work-code-query.d.ts +14 -0
- package/dist-server/service/work-code/work-code-query.js +106 -0
- package/dist-server/service/work-code/work-code-query.js.map +1 -0
- package/dist-server/service/work-code/work-code-type.d.ts +23 -0
- package/dist-server/service/work-code/work-code-type.js +89 -0
- package/dist-server/service/work-code/work-code-type.js.map +1 -0
- package/dist-server/service/work-code/work-code.d.ts +20 -0
- package/dist-server/service/work-code/work-code.js +94 -0
- package/dist-server/service/work-code/work-code.js.map +1 -0
- package/dist-server/service/work-code-detail/index.d.ts +5 -0
- package/dist-server/service/work-code-detail/index.js +9 -0
- package/dist-server/service/work-code-detail/index.js.map +1 -0
- package/dist-server/service/work-code-detail/work-code-detail-mutation.d.ts +10 -0
- package/dist-server/service/work-code-detail/work-code-detail-mutation.js +138 -0
- package/dist-server/service/work-code-detail/work-code-detail-mutation.js.map +1 -0
- package/dist-server/service/work-code-detail/work-code-detail-query.d.ts +13 -0
- package/dist-server/service/work-code-detail/work-code-detail-query.js +89 -0
- package/dist-server/service/work-code-detail/work-code-detail-query.js.map +1 -0
- package/dist-server/service/work-code-detail/work-code-detail-type.d.ts +20 -0
- package/dist-server/service/work-code-detail/work-code-detail-type.js +74 -0
- package/dist-server/service/work-code-detail/work-code-detail-type.js.map +1 -0
- package/dist-server/service/work-code-detail/work-code-detail.d.ts +19 -0
- package/dist-server/service/work-code-detail/work-code-detail.js +93 -0
- package/dist-server/service/work-code-detail/work-code-detail.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
import { store, CustomAlert, navigate } from '@things-factory/shell';
|
|
2
|
+
import { openPopup } from '@operato/layout';
|
|
3
|
+
import { closePopup } from '@operato/popup';
|
|
4
|
+
import { isMobileDevice } from '@operato/utils';
|
|
5
|
+
import { getEditor } from '@operato/data-grist';
|
|
6
|
+
import { TermsUtil } from './terms-util';
|
|
7
|
+
import { ValueUtil } from './value-util';
|
|
8
|
+
/**
|
|
9
|
+
* @license
|
|
10
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
11
|
+
* @author Shortstop <shortstop@hatiolab.com>
|
|
12
|
+
* @description UI 관련 유틸리티 함수 정의
|
|
13
|
+
*/
|
|
14
|
+
export class UiUtil {
|
|
15
|
+
/**
|
|
16
|
+
* @description 현재 디바이스가 모바일 장비인지 체크
|
|
17
|
+
**************************************
|
|
18
|
+
* @returns {Boolean} 모바일 장비 여부
|
|
19
|
+
*/
|
|
20
|
+
static isMobileEnv() {
|
|
21
|
+
return isMobileDevice();
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* @description 현재 로케일 정보 리턴
|
|
25
|
+
**************************************
|
|
26
|
+
* @returns {String} 현재 브라우저의 로케일 정보
|
|
27
|
+
*/
|
|
28
|
+
static currentLocale() {
|
|
29
|
+
let cookie = document.cookie;
|
|
30
|
+
cookie = cookie.substring(cookie.indexOf('i18next'));
|
|
31
|
+
if (cookie.indexOf(';') > -1) {
|
|
32
|
+
cookie = cookie.substring(0, cookie.indexOf(';'));
|
|
33
|
+
}
|
|
34
|
+
cookie = cookie.replace('i18next=', '');
|
|
35
|
+
if (cookie == 'ko')
|
|
36
|
+
return 'ko-KR';
|
|
37
|
+
else
|
|
38
|
+
return cookie;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @description 최종 애플리케이션 모듈 정보 리턴
|
|
42
|
+
*****************************************
|
|
43
|
+
* @returns {Object} 최종 애플리케이션 모듈
|
|
44
|
+
*/
|
|
45
|
+
static getApplicationModuleInfo() {
|
|
46
|
+
let modules = store.getState().app.modules;
|
|
47
|
+
return modules[modules.length - 1];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @description 현재 액티브 된 화면의 라우팅 정보
|
|
51
|
+
**************************************
|
|
52
|
+
* @returns {String} 현재 액티브 된 화면의 라우팅 정보
|
|
53
|
+
*/
|
|
54
|
+
static currentRouting() {
|
|
55
|
+
return store.getState().route.page;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* @description popup 닫기
|
|
59
|
+
************************
|
|
60
|
+
* @param {HTML} popup
|
|
61
|
+
*/
|
|
62
|
+
static closePopupBy(popup) {
|
|
63
|
+
closePopup(popup);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @description 오픈하고자 하는 엘리먼트를 받아 팝업 오픈
|
|
67
|
+
*************************************************
|
|
68
|
+
* @param {String} popupTitle 팝업 타이틀
|
|
69
|
+
* @param {String} popupSize 팝업 사이즈 ex) 'large', 'medium', 'small'
|
|
70
|
+
* @param {HTMLElement} element 팝업에 표시할 엘리먼트
|
|
71
|
+
* @param {Boolean} backdrop 백드롭 여부
|
|
72
|
+
* @param {String} help help 파일 경로
|
|
73
|
+
* @returns {Object} popup
|
|
74
|
+
*/
|
|
75
|
+
static openPopupByElement(popupTitle, popupSize, element, backdrop, help = '') {
|
|
76
|
+
if (popupSize === 'full') {
|
|
77
|
+
element.style.height = '95dvh';
|
|
78
|
+
}
|
|
79
|
+
return openPopup(element, {
|
|
80
|
+
backdrop: true,
|
|
81
|
+
hovering: popupSize === 'full' ? 'edge' : 'center',
|
|
82
|
+
size: popupSize === 'full' ? 'large' : popupSize,
|
|
83
|
+
title: popupTitle,
|
|
84
|
+
backdrop: backdrop,
|
|
85
|
+
help: help
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @description popupConfig에 포함된 element 정보를 이용해 팝업을 연다
|
|
90
|
+
**************************************************************
|
|
91
|
+
* @param {String} title 팝업 타이틀
|
|
92
|
+
* @param {Object} popupConfig 팝업 구성을 위한 설정 정보 ex) { module: '', location: '', tagname: '', size : '', popup_field: '', parent_field: ''}
|
|
93
|
+
* @param {Object} paramData 팝업에 넘겨 줄 파라미터
|
|
94
|
+
* @param {Function} popupCloseCallback 팝업 닫을 때 실행되기 위한 콜백 함수
|
|
95
|
+
*/
|
|
96
|
+
static async openDynamicPopup(title, popupConfig, paramData, popupCloseCallback) {
|
|
97
|
+
// 부모 필드
|
|
98
|
+
let parentValue = ValueUtil.isNotEmpty(popupConfig.parent_field)
|
|
99
|
+
? ValueUtil.getParams(paramData, ...popupConfig.parent_field.split('.'))
|
|
100
|
+
: undefined;
|
|
101
|
+
// 팝업 엘리먼트 생성
|
|
102
|
+
let htmlText = `<${popupConfig.tagname} route_name='${popupConfig.menu}' parent_id='${parentValue}' is_popup=true></${popupConfig.tagname}>`;
|
|
103
|
+
let htmlElements = UiUtil.htmlToElement(htmlText);
|
|
104
|
+
htmlElements.config = popupConfig;
|
|
105
|
+
// 파라미터 설정
|
|
106
|
+
if (ValueUtil.isNotEmpty(popupConfig.popup_field)) {
|
|
107
|
+
htmlElements[popupConfig.popup_field] = paramData;
|
|
108
|
+
}
|
|
109
|
+
// 팝업 오픈
|
|
110
|
+
let popup = UiUtil.openPopupByElement(title, popupConfig.size, htmlElements, true, popupConfig.help);
|
|
111
|
+
// 팝업 클로즈 핸들러
|
|
112
|
+
if (popupCloseCallback) {
|
|
113
|
+
popup.onclosed = popupCloseCallback;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* @description tagname, routing으로 커스텀 엘리먼트 생성
|
|
118
|
+
****************************************************
|
|
119
|
+
* @param {String} tagname 팝업에 포함할 태그 명
|
|
120
|
+
* @param {String} routing 라우팅
|
|
121
|
+
* @returns {HTMLElement} 커스텀 엘리먼트
|
|
122
|
+
*/
|
|
123
|
+
static createCustomElement(tagname, routing) {
|
|
124
|
+
let htmlStr = `<${tagname} route_name='${routing}'></${tagname}>`;
|
|
125
|
+
return UiUtil.htmlToElement(htmlStr);
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @description HTML 문자열을 elements로 변환
|
|
129
|
+
**************************************
|
|
130
|
+
* @param {String} htmlString html 문자열
|
|
131
|
+
* @returns {HTMLElement} 커스텀 엘리먼트
|
|
132
|
+
*/
|
|
133
|
+
static htmlToElement(htmlString) {
|
|
134
|
+
var template = document.createElement('template');
|
|
135
|
+
template.innerHTML = htmlString;
|
|
136
|
+
var elements = template.content.childNodes;
|
|
137
|
+
var element = elements[0];
|
|
138
|
+
template.content.removeChild(element);
|
|
139
|
+
return element;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* @description 페이지 이동
|
|
143
|
+
**************************************
|
|
144
|
+
* @param {String} url 페이지 URL (route 값)
|
|
145
|
+
* @param {Object} params 페이지 파라미터, null 가능
|
|
146
|
+
*/
|
|
147
|
+
static pageNavigate(url, params) {
|
|
148
|
+
let paramStr = params ? '?' : '';
|
|
149
|
+
if (params) {
|
|
150
|
+
paramStr += 'pass=' + JSON.stringify(params);
|
|
151
|
+
}
|
|
152
|
+
navigate(`${url}${paramStr}`);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* @description store의 정보 추출
|
|
156
|
+
****************************************************
|
|
157
|
+
* @param {String} accessor1 스토어 액세서 1, 빈 값 가능
|
|
158
|
+
* @param {String} accessor2 스토어 액세서 2, 빈 값 가능
|
|
159
|
+
* @param {String} accessor3 스토어 액세서 3, 빈 값 가능
|
|
160
|
+
* @returns {Object} store 정보
|
|
161
|
+
*/
|
|
162
|
+
static getStore(accessor1, accessor2, accessor3) {
|
|
163
|
+
let store = store.getState();
|
|
164
|
+
if (accessor1 && accessor2 && accessor3) {
|
|
165
|
+
return store[accessor1][accessor2][accessor3];
|
|
166
|
+
}
|
|
167
|
+
else if (accessor1 && accessor2) {
|
|
168
|
+
return store[accessor1][accessor2];
|
|
169
|
+
}
|
|
170
|
+
else if (accessor1) {
|
|
171
|
+
return store[accessor1];
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
return store;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* @description 커스텀 이벤트 전파
|
|
179
|
+
*************************************
|
|
180
|
+
* @param {String} eventName 이벤트 이름
|
|
181
|
+
* @param {Object} eventDetail 이벤트 상세 정보
|
|
182
|
+
*/
|
|
183
|
+
static fireCustomEvent(eventName, eventDetail) {
|
|
184
|
+
document.dispatchEvent(new CustomEvent(eventName, {
|
|
185
|
+
detail: eventDetail
|
|
186
|
+
}));
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* @description 토스트 메시지 표시
|
|
190
|
+
*************************************
|
|
191
|
+
* @param {String} type 토스트 타입
|
|
192
|
+
* @param {String} message 메시지
|
|
193
|
+
*/
|
|
194
|
+
static showToast(type, message) {
|
|
195
|
+
document.dispatchEvent(new CustomEvent('notify', {
|
|
196
|
+
detail: { type, message }
|
|
197
|
+
}));
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* @description Alert 메시지 창 표시
|
|
201
|
+
*************************************
|
|
202
|
+
* @param {String} titleCode Alert 제목 표시를 위한 용어 이름, 예) title.confirm
|
|
203
|
+
* @param {String} textCode Alert 텍스트 표시를 위한 용어 이름 예) text.are_you_sure
|
|
204
|
+
* @param {String} type Alert 창 유형 - info, error, warning ...
|
|
205
|
+
* @param {String} confirmButtonCode 확인 버튼 표시를 위한 용어 이름 예) confirm
|
|
206
|
+
* @param {String} [cancelButtonCode] 취소 버튼 표시를 위한 용어 이름 예) cancel
|
|
207
|
+
* @returns {Object} Alert 팝업
|
|
208
|
+
*/
|
|
209
|
+
static async showAlertPopup(titleCode, textCode, type, confirmButtonCode, cancelButtonCode) {
|
|
210
|
+
let popupTitle = TermsUtil.t(titleCode) || titleCode;
|
|
211
|
+
let popupText = TermsUtil.t(textCode) || textCode;
|
|
212
|
+
let alert = { title: popupTitle, text: popupText };
|
|
213
|
+
if (type) {
|
|
214
|
+
alert['type'] = type;
|
|
215
|
+
}
|
|
216
|
+
if (confirmButtonCode) {
|
|
217
|
+
alert['confirmButton'] = TermsUtil.tButton(confirmButtonCode);
|
|
218
|
+
}
|
|
219
|
+
if (cancelButtonCode) {
|
|
220
|
+
alert['cancelButton'] = TermsUtil.tButton(cancelButtonCode);
|
|
221
|
+
}
|
|
222
|
+
return await CustomAlert(alert);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* @description 필터 폼 내의 에디터들이 가지고 있는 값을 키-값 형태로 추출
|
|
226
|
+
*******************************************************
|
|
227
|
+
* @param {Object} filterForm 그리드 필터 폼
|
|
228
|
+
* @returns {Object} 필터 폼 내의 에디터들이 가지고 있는 값을 키-값 형태로 추출
|
|
229
|
+
*/
|
|
230
|
+
static getFilterFormData(filterForm) {
|
|
231
|
+
let formValues = {};
|
|
232
|
+
if (ValueUtil.isNotEmpty(filterForm)) {
|
|
233
|
+
let filters = filterForm.filters();
|
|
234
|
+
if (ValueUtil.isNotEmpty(filters)) {
|
|
235
|
+
filters.forEach(f => {
|
|
236
|
+
if (ValueUtil.isNotEmpty(f.value)) {
|
|
237
|
+
item[f.name] = f.value ? f.value : null;
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
return formValues;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* @description name으로 필터 폼 내 에디터를 찾아 값을 셋팅
|
|
246
|
+
*****************************************************
|
|
247
|
+
* @param {Object} filterForm 그리스트 필터 폼
|
|
248
|
+
* @param {String} name 그리스트 필터 폼 내 에디터의 이름
|
|
249
|
+
* @param {Object} value 설정할 값
|
|
250
|
+
*/
|
|
251
|
+
static setSearchFormEditorValue(filterForm, name, value) {
|
|
252
|
+
var _a;
|
|
253
|
+
if (ValueUtil.isNotEmpty(filterForm)) {
|
|
254
|
+
let editor = (_a = filterForm.renderRoot) === null || _a === void 0 ? void 0 : _a.querySelector(`[name='${name}']`);
|
|
255
|
+
if (ValueUtil.isNotEmpty(editor)) {
|
|
256
|
+
editor.value = value;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* @description 파라미터를 기준으로 유형에 맞는 에디터를 생성한다.
|
|
262
|
+
******************************************************
|
|
263
|
+
* @param {String} editorType 에디터 유형
|
|
264
|
+
* @param {Object} column 컬럼 Object
|
|
265
|
+
* @param {Object} record 레코드 Object
|
|
266
|
+
* @param {Number} rowIndex 추가할 열 Index
|
|
267
|
+
* @returns {HTMLElement} HTML 에디터
|
|
268
|
+
*/
|
|
269
|
+
static createEditorHtml(editorType, column, record, rowIndex) {
|
|
270
|
+
return getEditor(editorType)('', column, record, rowIndex, {});
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* @description 에디터에 값을 설정한다.
|
|
274
|
+
*********************************
|
|
275
|
+
* @param {Object} editor 에디터
|
|
276
|
+
* @param {String} newValue 설정할 값
|
|
277
|
+
*/
|
|
278
|
+
static setValueToEditor(editor, newValue) {
|
|
279
|
+
let input = UiUtil.getLeafInput(editor);
|
|
280
|
+
input.value = newValue;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* @description 엘리먼트 내 최 하단 Input Element를 추출
|
|
284
|
+
************************************************
|
|
285
|
+
* @param {Object} editor 에디터
|
|
286
|
+
* @returns {HTMLElement} 엘리먼트 내 최 하단 Input Element
|
|
287
|
+
*/
|
|
288
|
+
static getLeafInput(editor) {
|
|
289
|
+
let editorType = editor.getType();
|
|
290
|
+
if (editorType == 'code-editor') {
|
|
291
|
+
return editor.renderRoot.querySelector('ox-input-code');
|
|
292
|
+
}
|
|
293
|
+
else if (editorType == 'textarea') {
|
|
294
|
+
return editor.renderRoot.querySelector('textarea');
|
|
295
|
+
}
|
|
296
|
+
else if (editorType == 'select-combo') {
|
|
297
|
+
return editor.renderRoot.querySelector('ox-select').firstElementChild;
|
|
298
|
+
}
|
|
299
|
+
else if (editorType == 'barcode') {
|
|
300
|
+
return editor.renderRoot.querySelector('ox-input-barcode').renderRoot.querySelector('input');
|
|
301
|
+
}
|
|
302
|
+
else {
|
|
303
|
+
return editor.renderRoot.firstElementChild.editor;
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
//# sourceMappingURL=ui-util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui-util.js","sourceRoot":"","sources":["../../client/utils/ui-util.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,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AAE,CAAC;YACxC,OAAO,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC,iBAAiB,CAAA;QACvE,CAAC;aAAM,IAAI,UAAU,IAAI,SAAS,EAAE,CAAC;YACnC,OAAO,MAAM,CAAC,UAAU,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC,UAAU,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;QAC9F,CAAC;aAAM,CAAC;YACN,OAAO,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,MAAM,CAAA;QACnD,CAAC;IACH,CAAC;CACF","sourcesContent":["import { store, CustomAlert, navigate } from '@things-factory/shell'\n\nimport { openPopup } from '@operato/layout'\nimport { closePopup } from '@operato/popup'\nimport { isMobileDevice } from '@operato/utils'\nimport { getEditor } from '@operato/data-grist'\n\nimport { TermsUtil } from './terms-util'\nimport { ValueUtil } from './value-util'\n\n/**\n * @license\n * Copyright © HatioLab Inc. All rights reserved.\n * @author Shortstop <shortstop@hatiolab.com>\n * @description UI 관련 유틸리티 함수 정의\n */\nexport class UiUtil {\n /**\n * @description 현재 디바이스가 모바일 장비인지 체크\n **************************************\n * @returns {Boolean} 모바일 장비 여부\n */\n static isMobileEnv() {\n return isMobileDevice()\n }\n\n /**\n * @description 현재 로케일 정보 리턴\n **************************************\n * @returns {String} 현재 브라우저의 로케일 정보\n */\n static currentLocale() {\n let cookie = document.cookie\n cookie = cookie.substring(cookie.indexOf('i18next'))\n if (cookie.indexOf(';') > -1) {\n cookie = cookie.substring(0, cookie.indexOf(';'))\n }\n cookie = cookie.replace('i18next=', '')\n if (cookie == 'ko') return 'ko-KR'\n else return cookie\n }\n\n /**\n * @description 최종 애플리케이션 모듈 정보 리턴\n *****************************************\n * @returns {Object} 최종 애플리케이션 모듈\n */\n static getApplicationModuleInfo() {\n let modules = store.getState().app.modules\n return modules[modules.length - 1]\n }\n\n /**\n * @description 현재 액티브 된 화면의 라우팅 정보\n **************************************\n * @returns {String} 현재 액티브 된 화면의 라우팅 정보\n */\n static currentRouting() {\n return store.getState().route.page\n }\n\n /**\n * @description popup 닫기\n ************************\n * @param {HTML} popup\n */\n static closePopupBy(popup) {\n closePopup(popup)\n }\n\n /**\n * @description 오픈하고자 하는 엘리먼트를 받아 팝업 오픈\n *************************************************\n * @param {String} popupTitle 팝업 타이틀\n * @param {String} popupSize 팝업 사이즈 ex) 'large', 'medium', 'small'\n * @param {HTMLElement} element 팝업에 표시할 엘리먼트\n * @param {Boolean} backdrop 백드롭 여부\n * @param {String} help help 파일 경로\n * @returns {Object} popup\n */\n static openPopupByElement(popupTitle, popupSize, element, backdrop, help = '') {\n if (popupSize === 'full') {\n element.style.height = '95dvh'\n }\n\n return openPopup(element, {\n backdrop: true,\n hovering: popupSize === 'full' ? 'edge' : 'center',\n size: popupSize === 'full' ? 'large' : popupSize,\n title: popupTitle,\n backdrop: backdrop,\n help: help\n })\n }\n\n /**\n * @description popupConfig에 포함된 element 정보를 이용해 팝업을 연다\n **************************************************************\n * @param {String} title 팝업 타이틀\n * @param {Object} popupConfig 팝업 구성을 위한 설정 정보 ex) { module: '', location: '', tagname: '', size : '', popup_field: '', parent_field: ''}\n * @param {Object} paramData 팝업에 넘겨 줄 파라미터\n * @param {Function} popupCloseCallback 팝업 닫을 때 실행되기 위한 콜백 함수\n */\n static async openDynamicPopup(title, popupConfig, paramData, popupCloseCallback) {\n // 부모 필드\n let parentValue = ValueUtil.isNotEmpty(popupConfig.parent_field)\n ? ValueUtil.getParams(paramData, ...popupConfig.parent_field.split('.'))\n : undefined\n\n // 팝업 엘리먼트 생성\n let htmlText = `<${popupConfig.tagname} route_name='${popupConfig.menu}' parent_id='${parentValue}' is_popup=true></${popupConfig.tagname}>`\n let htmlElements = UiUtil.htmlToElement(htmlText)\n htmlElements.config = popupConfig\n\n // 파라미터 설정\n if (ValueUtil.isNotEmpty(popupConfig.popup_field)) {\n htmlElements[popupConfig.popup_field] = paramData\n }\n\n // 팝업 오픈\n let popup = UiUtil.openPopupByElement(title, popupConfig.size, htmlElements, true, popupConfig.help)\n\n // 팝업 클로즈 핸들러\n if (popupCloseCallback) {\n popup.onclosed = popupCloseCallback\n }\n }\n\n /**\n * @description tagname, routing으로 커스텀 엘리먼트 생성\n ****************************************************\n * @param {String} tagname 팝업에 포함할 태그 명\n * @param {String} routing 라우팅\n * @returns {HTMLElement} 커스텀 엘리먼트\n */\n static createCustomElement(tagname, routing) {\n let htmlStr = `<${tagname} route_name='${routing}'></${tagname}>`\n return UiUtil.htmlToElement(htmlStr)\n }\n\n /**\n * @description HTML 문자열을 elements로 변환\n **************************************\n * @param {String} htmlString html 문자열\n * @returns {HTMLElement} 커스텀 엘리먼트\n */\n static htmlToElement(htmlString) {\n var template = document.createElement('template')\n template.innerHTML = htmlString\n var elements = template.content.childNodes\n var element = elements[0]\n template.content.removeChild(element)\n return element\n }\n\n /**\n * @description 페이지 이동\n **************************************\n * @param {String} url 페이지 URL (route 값)\n * @param {Object} params 페이지 파라미터, null 가능\n */\n static pageNavigate(url, params) {\n let paramStr = params ? '?' : ''\n\n if (params) {\n paramStr += 'pass=' + JSON.stringify(params)\n }\n\n navigate(`${url}${paramStr}`)\n }\n\n /**\n * @description store의 정보 추출\n ****************************************************\n * @param {String} accessor1 스토어 액세서 1, 빈 값 가능\n * @param {String} accessor2 스토어 액세서 2, 빈 값 가능\n * @param {String} accessor3 스토어 액세서 3, 빈 값 가능\n * @returns {Object} store 정보\n */\n static getStore(accessor1, accessor2, accessor3) {\n let store = store.getState()\n\n if (accessor1 && accessor2 && accessor3) {\n return store[accessor1][accessor2][accessor3]\n } else if (accessor1 && accessor2) {\n return store[accessor1][accessor2]\n } else if (accessor1) {\n return store[accessor1]\n } else {\n return store\n }\n }\n\n /**\n * @description 커스텀 이벤트 전파\n *************************************\n * @param {String} eventName 이벤트 이름\n * @param {Object} eventDetail 이벤트 상세 정보\n */\n static fireCustomEvent(eventName, eventDetail) {\n document.dispatchEvent(\n new CustomEvent(eventName, {\n detail: eventDetail\n })\n )\n }\n\n /**\n * @description 토스트 메시지 표시\n *************************************\n * @param {String} type 토스트 타입\n * @param {String} message 메시지\n */\n static showToast(type, message) {\n document.dispatchEvent(\n new CustomEvent('notify', {\n detail: { type, message }\n })\n )\n }\n\n /**\n * @description Alert 메시지 창 표시\n *************************************\n * @param {String} titleCode Alert 제목 표시를 위한 용어 이름, 예) title.confirm\n * @param {String} textCode Alert 텍스트 표시를 위한 용어 이름 예) text.are_you_sure\n * @param {String} type Alert 창 유형 - info, error, warning ...\n * @param {String} confirmButtonCode 확인 버튼 표시를 위한 용어 이름 예) confirm\n * @param {String} [cancelButtonCode] 취소 버튼 표시를 위한 용어 이름 예) cancel\n * @returns {Object} Alert 팝업\n */\n static async showAlertPopup(titleCode, textCode, type, confirmButtonCode, cancelButtonCode) {\n let popupTitle = TermsUtil.t(titleCode) || titleCode\n let popupText = TermsUtil.t(textCode) || textCode\n let alert = { title: popupTitle, text: popupText }\n\n if (type) {\n alert['type'] = type\n }\n\n if (confirmButtonCode) {\n alert['confirmButton'] = TermsUtil.tButton(confirmButtonCode)\n }\n\n if (cancelButtonCode) {\n alert['cancelButton'] = TermsUtil.tButton(cancelButtonCode)\n }\n\n return await CustomAlert(alert)\n }\n\n /**\n * @description 필터 폼 내의 에디터들이 가지고 있는 값을 키-값 형태로 추출\n *******************************************************\n * @param {Object} filterForm 그리드 필터 폼\n * @returns {Object} 필터 폼 내의 에디터들이 가지고 있는 값을 키-값 형태로 추출\n */\n static getFilterFormData(filterForm) {\n let formValues = {}\n\n if (ValueUtil.isNotEmpty(filterForm)) {\n let filters = filterForm.filters()\n\n if (ValueUtil.isNotEmpty(filters)) {\n filters.forEach(f => {\n if (ValueUtil.isNotEmpty(f.value)) {\n item[f.name] = f.value ? f.value : null\n }\n })\n }\n }\n\n return formValues\n }\n\n /**\n * @description name으로 필터 폼 내 에디터를 찾아 값을 셋팅\n *****************************************************\n * @param {Object} filterForm 그리스트 필터 폼\n * @param {String} name 그리스트 필터 폼 내 에디터의 이름\n * @param {Object} value 설정할 값\n */\n static setSearchFormEditorValue(filterForm, name, value) {\n if (ValueUtil.isNotEmpty(filterForm)) {\n let editor = filterForm.renderRoot?.querySelector(`[name='${name}']`)\n\n if (ValueUtil.isNotEmpty(editor)) {\n editor.value = value\n }\n }\n }\n\n /**\n * @description 파라미터를 기준으로 유형에 맞는 에디터를 생성한다.\n ******************************************************\n * @param {String} editorType 에디터 유형\n * @param {Object} column 컬럼 Object\n * @param {Object} record 레코드 Object\n * @param {Number} rowIndex 추가할 열 Index\n * @returns {HTMLElement} HTML 에디터\n */\n static createEditorHtml(editorType, column, record, rowIndex) {\n return getEditor(editorType)('', column, record, rowIndex, {})\n }\n\n /**\n * @description 에디터에 값을 설정한다.\n *********************************\n * @param {Object} editor 에디터\n * @param {String} newValue 설정할 값\n */\n static setValueToEditor(editor, newValue) {\n let input = UiUtil.getLeafInput(editor)\n input.value = newValue\n }\n\n /**\n * @description 엘리먼트 내 최 하단 Input Element를 추출\n ************************************************\n * @param {Object} editor 에디터\n * @returns {HTMLElement} 엘리먼트 내 최 하단 Input Element\n */\n static getLeafInput(editor) {\n let editorType = editor.getType()\n\n if (editorType == 'code-editor') {\n return editor.renderRoot.querySelector('ox-input-code')\n } else if (editorType == 'textarea') {\n return editor.renderRoot.querySelector('textarea')\n } else if (editorType == 'select-combo') {\n return editor.renderRoot.querySelector('ox-select').firstElementChild\n } else if (editorType == 'barcode') {\n return editor.renderRoot.querySelector('ox-input-barcode').renderRoot.querySelector('input')\n } else {\n return editor.renderRoot.firstElementChild.editor\n }\n }\n}\n"]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
4
|
+
* @author Shortstop <shortstop@hatiolab.com>
|
|
5
|
+
* @description 데이터 핸들링 관련 유틸리티 함수 정의
|
|
6
|
+
*/
|
|
7
|
+
export class ValueUtil {
|
|
8
|
+
/**
|
|
9
|
+
* @description object, string, number, array 빈 값 여부 검사
|
|
10
|
+
**********************************************************
|
|
11
|
+
* @param {Object} value
|
|
12
|
+
* @returns {Boolean}
|
|
13
|
+
*/
|
|
14
|
+
static isEmpty(value: any): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* @description object, string, number, array 빈 값이 아닌지 여부 검사
|
|
17
|
+
*****************************************************************
|
|
18
|
+
* @param {Object} value
|
|
19
|
+
* @returns {Boolean}
|
|
20
|
+
*/
|
|
21
|
+
static isNotEmpty(value: any): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* @description 두 객체가 동일한지 비교
|
|
24
|
+
**********************************
|
|
25
|
+
* @param {*} data1
|
|
26
|
+
* @param {*} data2
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
static isEquals(data1: any, data2: any): any;
|
|
30
|
+
/**
|
|
31
|
+
* @description 값을 정수로 변환
|
|
32
|
+
**********************************
|
|
33
|
+
* @param {*} value
|
|
34
|
+
* @param {*} defaultValue
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
static toInteger(value: any, defaultValue: any): any;
|
|
38
|
+
/**
|
|
39
|
+
* @description 값을 Boolean으로 변환
|
|
40
|
+
**********************************
|
|
41
|
+
* @param {String} value
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
static toBoolean(value: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* @description config, data의 key 값을 비교해 결과를 리턴한다.
|
|
47
|
+
* 값에 * 는 체크하지 않는다.
|
|
48
|
+
****************************************
|
|
49
|
+
* @param {Object} config
|
|
50
|
+
* @param {Object} data
|
|
51
|
+
* @param {String || Array} keys
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
static compareObjectValues(config: any, data: any, keys: any): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* @description dataObject 에서 key 값을 찾아 isTransMsg 옵션을 적용해 retObjct에 반영한다.
|
|
57
|
+
**********************************************************************************
|
|
58
|
+
* @param {Object} retObj
|
|
59
|
+
* @param {Object} dataObj
|
|
60
|
+
* @param {String} key
|
|
61
|
+
* @param {Boolean} isTransMsg
|
|
62
|
+
* @returns
|
|
63
|
+
*/
|
|
64
|
+
static setParams(retObj: any, dataObj: any, key: string, isTransMsg: boolean): any;
|
|
65
|
+
/**
|
|
66
|
+
* @description data에서 key(Array)를 찾아 리턴
|
|
67
|
+
********************************************
|
|
68
|
+
* @param {Object} data
|
|
69
|
+
* @param {...String} keys
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
static getParams(data: any, ...keys: string[]): any;
|
|
73
|
+
/**
|
|
74
|
+
* @description sourceList에 존재하는 오브젝트의 keys 필드들을 targetList로 복사
|
|
75
|
+
***********************************************************************
|
|
76
|
+
* @param {Array} sourceList
|
|
77
|
+
* @param {Array} targetList
|
|
78
|
+
* @param {...String} keys
|
|
79
|
+
* @returns {Array} 복사한 객체 리스트
|
|
80
|
+
*/
|
|
81
|
+
static populateArray(sourceList: any[], targetList: any[], ...keys: string[]): any[];
|
|
82
|
+
/**
|
|
83
|
+
* @description source에 존재하는 keys 필드들을 target으로 복사
|
|
84
|
+
********************************************************
|
|
85
|
+
* @param {Object} source
|
|
86
|
+
* @param {Object} target
|
|
87
|
+
* @param {...String} keys
|
|
88
|
+
* @returns {Object} 복사한 객체
|
|
89
|
+
*/
|
|
90
|
+
static populateObject(source: any, target: any, ...keys: string[]): any;
|
|
91
|
+
/**
|
|
92
|
+
* @description source에 존재하는 keys 필드들을 target으로 복사
|
|
93
|
+
********************************************************
|
|
94
|
+
* @param {Object} sourceObj
|
|
95
|
+
* @param {Object} targetObj
|
|
96
|
+
* @returns {Object} 복사한 객체
|
|
97
|
+
*/
|
|
98
|
+
static replaceVariableObject(sourceObj: any, targetObj: any): any;
|
|
99
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import isEqual from 'lodash-es/isEqual';
|
|
2
|
+
import { TermsUtil } from './terms-util';
|
|
3
|
+
/**
|
|
4
|
+
* @license
|
|
5
|
+
* Copyright © HatioLab Inc. All rights reserved.
|
|
6
|
+
* @author Shortstop <shortstop@hatiolab.com>
|
|
7
|
+
* @description 데이터 핸들링 관련 유틸리티 함수 정의
|
|
8
|
+
*/
|
|
9
|
+
export class ValueUtil {
|
|
10
|
+
/**
|
|
11
|
+
* @description object, string, number, array 빈 값 여부 검사
|
|
12
|
+
**********************************************************
|
|
13
|
+
* @param {Object} value
|
|
14
|
+
* @returns {Boolean}
|
|
15
|
+
*/
|
|
16
|
+
static isEmpty(value) {
|
|
17
|
+
if (value === undefined) {
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
else if (value === null) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
else if (typeof value === 'boolean') {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
else if (typeof value === 'string' || typeof value === 'number') {
|
|
27
|
+
if (value == '')
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
else if (Array.isArray(value)) {
|
|
31
|
+
if (value.length == 0)
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
else if (typeof value === 'object') {
|
|
35
|
+
if (Object.keys(value).length == 0)
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* @description object, string, number, array 빈 값이 아닌지 여부 검사
|
|
42
|
+
*****************************************************************
|
|
43
|
+
* @param {Object} value
|
|
44
|
+
* @returns {Boolean}
|
|
45
|
+
*/
|
|
46
|
+
static isNotEmpty(value) {
|
|
47
|
+
return !ValueUtil.isEmpty(value);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* @description 두 객체가 동일한지 비교
|
|
51
|
+
**********************************
|
|
52
|
+
* @param {*} data1
|
|
53
|
+
* @param {*} data2
|
|
54
|
+
* @returns
|
|
55
|
+
*/
|
|
56
|
+
static isEquals(data1, data2) {
|
|
57
|
+
return isEqual(data1, data2);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* @description 값을 정수로 변환
|
|
61
|
+
**********************************
|
|
62
|
+
* @param {*} value
|
|
63
|
+
* @param {*} defaultValue
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
static toInteger(value, defaultValue) {
|
|
67
|
+
return ValueUtil.isEmpty(value) ? (defaultValue ? defaultValue : 0) : parseInt(value);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* @description 값을 Boolean으로 변환
|
|
71
|
+
**********************************
|
|
72
|
+
* @param {String} value
|
|
73
|
+
* @returns
|
|
74
|
+
*/
|
|
75
|
+
static toBoolean(value) {
|
|
76
|
+
return ValueUtil.isEmpty(value) ? false : value == 'true' || value == 't' || value == 'TRUE' || value == 'T' || value == 'on' || value == 'ON';
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @description config, data의 key 값을 비교해 결과를 리턴한다.
|
|
80
|
+
* 값에 * 는 체크하지 않는다.
|
|
81
|
+
****************************************
|
|
82
|
+
* @param {Object} config
|
|
83
|
+
* @param {Object} data
|
|
84
|
+
* @param {String || Array} keys
|
|
85
|
+
* @returns
|
|
86
|
+
*/
|
|
87
|
+
static compareObjectValues(config, data, keys) {
|
|
88
|
+
let isEquals = true;
|
|
89
|
+
keys.forEach(key => {
|
|
90
|
+
let compareValue = config[key];
|
|
91
|
+
if (compareValue === '*') {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
let recordValue = data[key] || '';
|
|
95
|
+
if (ValueUtil.isEmpty(compareValue)) {
|
|
96
|
+
if (ValueUtil.isNotEmpty(recordValue)) {
|
|
97
|
+
isEquals = false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
if (compareValue != recordValue) {
|
|
102
|
+
isEquals = false;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
if (!isEquals) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
return isEquals;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* @description dataObject 에서 key 값을 찾아 isTransMsg 옵션을 적용해 retObjct에 반영한다.
|
|
113
|
+
**********************************************************************************
|
|
114
|
+
* @param {Object} retObj
|
|
115
|
+
* @param {Object} dataObj
|
|
116
|
+
* @param {String} key
|
|
117
|
+
* @param {Boolean} isTransMsg
|
|
118
|
+
* @returns
|
|
119
|
+
*/
|
|
120
|
+
static setParams(retObj, dataObj, key, isTransMsg) {
|
|
121
|
+
let value = ValueUtil.getParams(dataObj, key);
|
|
122
|
+
if (ValueUtil.isNotEmpty(value)) {
|
|
123
|
+
retObj[key] = isTransMsg === true ? TermsUtil.t(value) : value;
|
|
124
|
+
}
|
|
125
|
+
return retObj;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @description data에서 key(Array)를 찾아 리턴
|
|
129
|
+
********************************************
|
|
130
|
+
* @param {Object} data
|
|
131
|
+
* @param {...String} keys
|
|
132
|
+
* @returns
|
|
133
|
+
*/
|
|
134
|
+
static getParams(data, ...keys) {
|
|
135
|
+
// probably same as followings
|
|
136
|
+
// return lodash.get(data, keys.join('.'))
|
|
137
|
+
// keys 파라미터가 없으면 return
|
|
138
|
+
if (arguments.length <= 1) {
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
let key = keys[0];
|
|
142
|
+
// data 에 key가 없으면 return
|
|
143
|
+
if (ValueUtil.isEmpty(data[key])) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
let paramData = data[key];
|
|
147
|
+
if (keys.length > 1) {
|
|
148
|
+
// 현재 이후에 키가 더 있으면 재귀 호출
|
|
149
|
+
return ValueUtil.getParams(paramData, ...keys.slice(1));
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
return paramData;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* @description sourceList에 존재하는 오브젝트의 keys 필드들을 targetList로 복사
|
|
157
|
+
***********************************************************************
|
|
158
|
+
* @param {Array} sourceList
|
|
159
|
+
* @param {Array} targetList
|
|
160
|
+
* @param {...String} keys
|
|
161
|
+
* @returns {Array} 복사한 객체 리스트
|
|
162
|
+
*/
|
|
163
|
+
static populateArray(sourceList, targetList, ...keys) {
|
|
164
|
+
targetList = targetList || [];
|
|
165
|
+
keys = keys || Object.keys(sourceList);
|
|
166
|
+
if (ValueUtil.isNotEmpty(keys)) {
|
|
167
|
+
targetList = sourceList.map((source, index) => {
|
|
168
|
+
let target = targetList.length > index ? targetList[index] : {};
|
|
169
|
+
return ValueUtil.populateObject(source, target, keys);
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
return targetList;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* @description source에 존재하는 keys 필드들을 target으로 복사
|
|
176
|
+
********************************************************
|
|
177
|
+
* @param {Object} source
|
|
178
|
+
* @param {Object} target
|
|
179
|
+
* @param {...String} keys
|
|
180
|
+
* @returns {Object} 복사한 객체
|
|
181
|
+
*/
|
|
182
|
+
static populateObject(source, target, ...keys) {
|
|
183
|
+
target = target || {};
|
|
184
|
+
keys = keys || Object.keys(source);
|
|
185
|
+
if (ValueUtil.isNotEmpty(keys)) {
|
|
186
|
+
keys.forEach(key => {
|
|
187
|
+
target[key] = source[key];
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
return target;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* @description source에 존재하는 keys 필드들을 target으로 복사
|
|
194
|
+
********************************************************
|
|
195
|
+
* @param {Object} sourceObj
|
|
196
|
+
* @param {Object} targetObj
|
|
197
|
+
* @returns {Object} 복사한 객체
|
|
198
|
+
*/
|
|
199
|
+
static replaceVariableObject(sourceObj, targetObj) {
|
|
200
|
+
let objKeys = Object.keys(sourceObj);
|
|
201
|
+
let targetKeys = Object.keys(targetObj);
|
|
202
|
+
objKeys.forEach(key => {
|
|
203
|
+
let value = sourceObj[key];
|
|
204
|
+
if (typeof value == 'string' && value.startsWith('$')) {
|
|
205
|
+
let valueFieldName = value.replace('$', '');
|
|
206
|
+
if (targetKeys.includes(valueFieldName)) {
|
|
207
|
+
sourceObj[key] = targetObj[valueFieldName];
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
return sourceObj;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=value-util.js.map
|