@globalpayments/vega 2.37.0 → 2.37.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.
- package/dist/cjs/{app-globals-7980768c.js → app-globals-7087f121.js} +4 -4
- package/dist/cjs/{content-state-9a9a4bd8.js → content-state-f97d3278.js} +2 -2
- package/dist/cjs/{form-field-controller-slimmer-0303f4a7.js → form-field-controller-slimmer-48c0ad0b.js} +1 -1
- package/dist/cjs/{image-annotation-action-8e622f61.js → image-annotation-action-7d82f7e1.js} +2 -2
- package/dist/cjs/{index-7c81de06.js → index-0546e2ea.js} +1 -1
- package/dist/cjs/index.cjs.js +5 -5
- package/dist/cjs/loader.cjs.js +6 -6
- package/dist/cjs/{node-annotation.abstract-2c8373c1.js → node-annotation.abstract-4f6df9cf.js} +1 -1
- package/dist/cjs/{string-input-formatter-slimmer-396b1cee.js → string-input-formatter-slimmer-f45931fd.js} +113 -34
- package/dist/cjs/{sub-state-notify-slimmer-ae490543.js → sub-state-notify-slimmer-b1f1e61a.js} +1 -1
- package/dist/cjs/{sub-state-observer-slimmer-080731bc.js → sub-state-observer-slimmer-02634647.js} +1 -1
- package/dist/cjs/vega-app-footer.cjs.entry.js +3 -0
- package/dist/cjs/vega-button-group_2.cjs.entry.js +3 -3
- package/dist/cjs/vega-button-link.cjs.entry.js +1 -0
- package/dist/cjs/vega-calendar_3.cjs.entry.js +3 -3
- package/dist/cjs/vega-checkbox_2.cjs.entry.js +11 -4
- package/dist/cjs/vega-color-picker.cjs.entry.js +2 -2
- package/dist/cjs/vega-combo-box.cjs.entry.js +2 -2
- package/dist/cjs/vega-date-picker_2.cjs.entry.js +6 -6
- package/dist/cjs/vega-dropdown_5.cjs.entry.js +3 -3
- package/dist/cjs/vega-env-manager-23b8b23c.js +2 -2
- package/dist/cjs/vega-file-uploader.cjs.entry.js +2 -2
- package/dist/cjs/vega-form.cjs.entry.js +2 -2
- package/dist/cjs/vega-image-uploader.cjs.entry.js +3 -2
- package/dist/cjs/vega-input-credit-card.cjs.entry.js +2 -2
- package/dist/cjs/vega-input-numeric.cjs.entry.js +3 -3
- package/dist/cjs/vega-input-phone-number.cjs.entry.js +5 -2
- package/dist/cjs/vega-input-range.cjs.entry.js +2 -2
- package/dist/cjs/vega-input-select.cjs.entry.js +2 -2
- package/dist/cjs/vega-input.cjs.entry.js +10 -8
- package/dist/cjs/{vega-internal-event-id-b12071ea.js → vega-internal-event-id-bda63e14.js} +2 -0
- package/dist/cjs/vega-item-toggle.cjs.entry.js +2 -0
- package/dist/cjs/vega-left-nav_5.cjs.entry.js +6 -4
- package/dist/cjs/vega-loader-wrapper_2.cjs.entry.js +54 -1
- package/dist/cjs/vega-popover_2.cjs.entry.js +1 -1
- package/dist/cjs/vega-radio_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-rich-text-content.cjs.entry.js +6 -6
- package/dist/cjs/vega-rich-text-editor_4.cjs.entry.js +681 -413
- package/dist/cjs/vega-selection-chip_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-selection-tile_2.cjs.entry.js +4 -4
- package/dist/cjs/vega-sidenav_3.cjs.entry.js +3 -3
- package/dist/cjs/vega-signature-capture.cjs.entry.js +3 -2
- package/dist/cjs/{vega-skeleton-loader-controller-ef43cfc1.js → vega-skeleton-loader-controller-00dbdf29.js} +11 -3
- package/dist/cjs/vega-stepper.cjs.entry.js +2 -2
- package/dist/cjs/vega-table_8.cjs.entry.js +10 -7
- package/dist/cjs/vega-textarea.cjs.entry.js +2 -2
- package/dist/cjs/vega-time-picker_2.cjs.entry.js +2 -2
- package/dist/cjs/vega-toggle-switch.cjs.entry.js +2 -2
- package/dist/cjs/vega.cjs.js +6 -6
- package/dist/collection/components/vega-app-footer/vega-app-footer.js +12 -0
- package/dist/collection/components/vega-button-link/vega-button-link.js +4 -0
- package/dist/collection/components/vega-checkbox/vega-checkbox.js +9 -1
- package/dist/collection/components/vega-image-uploader/vega-image-uploader.js +4 -0
- package/dist/collection/components/vega-input-phone-number/vega-input-phone-number.js +12 -0
- package/dist/collection/components/vega-input-select/vega-input-select.js +1 -1
- package/dist/collection/components/vega-item-toggle/vega-item-toggle.js +8 -0
- package/dist/collection/components/vega-loader-wrapper/slimmers/controllers/manage-vega-loader-wrapper-z-index-controller.js +49 -0
- package/dist/collection/components/vega-loader-wrapper/vega-loader-wrapper.js +5 -0
- package/dist/collection/components/vega-nav/vega-left-nav-link/vega-left-nav-link.js +7 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.js +190 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.js +18 -123
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.js +9 -11
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.js +8 -18
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-paste-handler.js +2 -2
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-text-handler.js +5 -4
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/insert-composition-text-controller.js +244 -0
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/selection-controller.js +13 -5
- package/dist/collection/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.js +16 -70
- package/dist/collection/components/vega-rich-text-editor/vega-rich-text-editor.js +22 -14
- package/dist/collection/components/vega-signature-capture/vega-signature-capture.js +4 -0
- package/dist/collection/components/vega-table/slimmers/controllers/vega-table-editable-controller.js +2 -3
- package/dist/collection/components/vega-table/slimmers/renderers/vega-table-renderer.js +5 -1
- package/dist/collection/helpers/event-manager/event-id/vega-internal-event-id.js +1 -0
- package/dist/collection/helpers/formatter/string-formatter/custom-formatter-strategy.js +3 -1
- package/dist/collection/helpers/formatter/string-formatter/number-mask-strategy.js +3 -1
- package/dist/collection/helpers/formatter/string-formatter/string-format-strategy.abstract.js +52 -0
- package/dist/collection/helpers/formatter/string-formatter/string-mask-strategy.js +6 -7
- package/dist/collection/helpers/formatter/string-formatter/thousand-comma-strategy.js +2 -1
- package/dist/collection/helpers/formatter/test/string-formatter/custom-formatter-strategy.test.js +2 -1
- package/dist/collection/helpers/formatter/test/string-formatter/number-mask-strategy.test.js +9 -0
- package/dist/collection/helpers/formatter/test/string-formatter/string-mask-strategy.test.js +62 -4
- package/dist/collection/helpers/loading-indicator/tests/vega-loader-controller.test.js +29 -2
- package/dist/collection/helpers/loading-indicator/vega-loader-controller.js +11 -3
- package/dist/collection/helpers/slimmers/string-input-formatter-slimmer.js +53 -25
- package/dist/collection/helpers/slimmers/test/string-input-formatter-slimmer.test.js +2 -1
- package/dist/esm/{app-globals-6912a75d.js → app-globals-4cca4a96.js} +4 -4
- package/dist/esm/{content-state-c2d29b35.js → content-state-ccf5f960.js} +3 -3
- package/dist/esm/{form-field-controller-slimmer-7136b7fa.js → form-field-controller-slimmer-3535e76a.js} +1 -1
- package/dist/esm/{image-annotation-action-84422458.js → image-annotation-action-3da42221.js} +2 -2
- package/dist/esm/{index-b2045ad0.js → index-6e05b241.js} +1 -1
- package/dist/esm/index.js +5 -5
- package/dist/esm/loader.js +6 -6
- package/dist/esm/{node-annotation.abstract-a58b5a49.js → node-annotation.abstract-b2e36bc4.js} +1 -1
- package/dist/esm/{string-input-formatter-slimmer-0ecbf367.js → string-input-formatter-slimmer-d4132497.js} +113 -35
- package/dist/esm/{sub-state-notify-slimmer-4a201088.js → sub-state-notify-slimmer-51151fc3.js} +1 -1
- package/dist/esm/{sub-state-observer-slimmer-0d6da563.js → sub-state-observer-slimmer-d77a1c46.js} +1 -1
- package/dist/esm/vega-app-footer.entry.js +3 -0
- package/dist/esm/vega-button-group_2.entry.js +3 -3
- package/dist/esm/vega-button-link.entry.js +1 -0
- package/dist/esm/vega-calendar_3.entry.js +3 -3
- package/dist/esm/vega-checkbox_2.entry.js +11 -4
- package/dist/esm/vega-color-picker.entry.js +2 -2
- package/dist/esm/vega-combo-box.entry.js +2 -2
- package/dist/esm/vega-date-picker_2.entry.js +6 -6
- package/dist/esm/vega-dropdown_5.entry.js +3 -3
- package/dist/esm/vega-env-manager-8f8dc473.js +2 -2
- package/dist/esm/vega-file-uploader.entry.js +2 -2
- package/dist/esm/vega-form.entry.js +2 -2
- package/dist/esm/vega-image-uploader.entry.js +3 -2
- package/dist/esm/vega-input-credit-card.entry.js +2 -2
- package/dist/esm/vega-input-numeric.entry.js +3 -3
- package/dist/esm/vega-input-phone-number.entry.js +5 -2
- package/dist/esm/vega-input-range.entry.js +2 -2
- package/dist/esm/vega-input-select.entry.js +2 -2
- package/dist/esm/vega-input.entry.js +10 -8
- package/dist/esm/{vega-internal-event-id-458939b6.js → vega-internal-event-id-d0690d0d.js} +2 -1
- package/dist/esm/vega-item-toggle.entry.js +2 -0
- package/dist/esm/vega-left-nav_5.entry.js +6 -4
- package/dist/esm/vega-loader-wrapper_2.entry.js +55 -2
- package/dist/esm/vega-popover_2.entry.js +1 -1
- package/dist/esm/vega-radio_2.entry.js +2 -2
- package/dist/esm/vega-rich-text-content.entry.js +6 -6
- package/dist/esm/vega-rich-text-editor_4.entry.js +681 -413
- package/dist/esm/vega-selection-chip_2.entry.js +4 -4
- package/dist/esm/vega-selection-tile_2.entry.js +4 -4
- package/dist/esm/vega-sidenav_3.entry.js +3 -3
- package/dist/esm/vega-signature-capture.entry.js +3 -2
- package/dist/esm/{vega-skeleton-loader-controller-0044d77f.js → vega-skeleton-loader-controller-5aea7aeb.js} +11 -3
- package/dist/esm/vega-stepper.entry.js +2 -2
- package/dist/esm/vega-table_8.entry.js +10 -7
- package/dist/esm/vega-textarea.entry.js +2 -2
- package/dist/esm/vega-time-picker_2.entry.js +2 -2
- package/dist/esm/vega-toggle-switch.entry.js +2 -2
- package/dist/esm/vega.js +6 -6
- package/dist/types/components/vega-app-footer/vega-app-footer.d.ts +3 -0
- package/dist/types/components/vega-button-link/vega-button-link.d.ts +1 -0
- package/dist/types/components/vega-checkbox/vega-checkbox.d.ts +2 -0
- package/dist/types/components/vega-date-picker/slimmers/controllers/vega-date-picker-format-controller.d.ts +1 -1
- package/dist/types/components/vega-image-uploader/vega-image-uploader.d.ts +1 -0
- package/dist/types/components/vega-input/slimmers/controllers/vega-input-mask-config-controller.d.ts +1 -1
- package/dist/types/components/vega-input-phone-number/vega-input-phone-number.d.ts +3 -0
- package/dist/types/components/vega-input-select/types.d.ts +1 -0
- package/dist/types/components/vega-item-toggle/vega-item-toggle.d.ts +2 -0
- package/dist/types/components/vega-loader-wrapper/slimmers/controllers/manage-vega-loader-wrapper-z-index-controller.d.ts +21 -0
- package/dist/types/components/vega-loader-wrapper/vega-loader-wrapper.d.ts +2 -0
- package/dist/types/components/vega-nav/vega-left-nav-link/vega-left-nav-link.d.ts +3 -1
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/delete-selected-nodes-controller.d.ts +57 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/base-handler.d.ts +11 -28
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/delete-content-handler.d.ts +4 -4
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/helper/input-event-handler/insert-line-break-handler.d.ts +1 -8
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/insert-composition-text-controller.d.ts +99 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/selection-controller.d.ts +1 -0
- package/dist/types/components/vega-rich-text-editor/slimmers/controllers/user-input-controller.d.ts +2 -21
- package/dist/types/components/vega-rich-text-editor/vega-rich-text-editor.d.ts +7 -2
- package/dist/types/components/vega-signature-capture/vega-signature-capture.d.ts +1 -0
- package/dist/types/components/vega-table/slimmers/renderers/vega-table-renderer.d.ts +1 -0
- package/dist/types/components.d.ts +31 -5
- package/dist/types/helpers/event-manager/event-id/vega-internal-event-id.d.ts +1 -0
- package/dist/types/helpers/formatter/string-formatter/custom-formatter-strategy.d.ts +3 -3
- package/dist/types/helpers/formatter/string-formatter/number-mask-strategy.d.ts +2 -2
- package/dist/types/helpers/formatter/string-formatter/string-format-strategy.abstract.d.ts +48 -0
- package/dist/types/helpers/formatter/string-formatter/string-mask-strategy.d.ts +6 -10
- package/dist/types/helpers/formatter/string-formatter/thousand-comma-strategy.d.ts +2 -2
- package/dist/types/helpers/loading-indicator/vega-loader-controller.d.ts +1 -0
- package/dist/types/helpers/slimmers/string-input-formatter-slimmer.d.ts +20 -4
- package/dist/types/types/components.type.d.ts +1 -5
- package/dist/types/types/public-api.d.ts +2 -0
- package/dist/vega/index.esm.js +1 -1
- package/dist/vega/{p-2d36dbfe.js → p-0461e318.js} +1 -1
- package/dist/vega/{p-1f67c930.entry.js → p-12fe63c1.entry.js} +1 -1
- package/dist/vega/{p-29dd376c.entry.js → p-1b67c443.entry.js} +1 -1
- package/dist/vega/{p-5f82eb88.js → p-1d93b3a9.js} +1 -1
- package/dist/vega/p-20326c64.js +1 -0
- package/dist/vega/{p-fbb91e25.entry.js → p-23fd9401.entry.js} +1 -1
- package/dist/vega/{p-5d7d0085.entry.js → p-267cde46.entry.js} +1 -1
- package/dist/vega/{p-ca239f51.js → p-29d6ec6c.js} +1 -1
- package/dist/vega/{p-d57920df.entry.js → p-2fecbcf9.entry.js} +1 -1
- package/dist/vega/{p-fe9644a0.js → p-348e95ba.js} +1 -1
- package/dist/vega/{p-00de36e4.js → p-34bd9204.js} +1 -1
- package/dist/vega/{p-3aec260c.entry.js → p-3cb90bdf.entry.js} +1 -1
- package/dist/vega/{p-fcab2244.entry.js → p-3e8f9fcf.entry.js} +1 -1
- package/dist/vega/{p-233e6715.entry.js → p-497f2f86.entry.js} +1 -1
- package/dist/vega/p-50eabdca.entry.js +1 -0
- package/dist/vega/{p-503ff1ef.js → p-52a8a4f8.js} +1 -1
- package/dist/vega/p-5f377954.js +1 -1
- package/dist/vega/{p-766a0cdd.entry.js → p-6419e13e.entry.js} +1 -1
- package/dist/vega/{p-b2b41aa4.entry.js → p-7198d675.entry.js} +1 -1
- package/dist/vega/p-76a8ccbb.js +1 -0
- package/dist/vega/{p-00f4cf6a.entry.js → p-7baa4fae.entry.js} +1 -1
- package/dist/vega/p-7edcb8d0.entry.js +1 -0
- package/dist/vega/{p-bbea0599.entry.js → p-904b489a.entry.js} +1 -1
- package/dist/vega/{p-fea15767.entry.js → p-9689ad99.entry.js} +1 -1
- package/dist/vega/p-9728d571.entry.js +1 -0
- package/dist/vega/{p-95e50f3a.entry.js → p-a2a34239.entry.js} +1 -1
- package/dist/vega/{p-b1096431.entry.js → p-a7e078ac.entry.js} +1 -1
- package/dist/vega/{p-eb798062.entry.js → p-a7f40a65.entry.js} +1 -1
- package/dist/vega/{p-7fedfba5.js → p-a8b16ff2.js} +1 -1
- package/dist/vega/{p-9625162b.entry.js → p-aed80794.entry.js} +1 -1
- package/dist/vega/{p-7da8b05f.js → p-b517ed15.js} +1 -1
- package/dist/vega/{p-b6b4e40f.entry.js → p-b809f3d7.entry.js} +1 -1
- package/dist/vega/{p-0b9480a9.entry.js → p-b9a0f136.entry.js} +1 -1
- package/dist/vega/{p-5a19bcb5.entry.js → p-ba077ca8.entry.js} +1 -1
- package/dist/vega/{p-53360bc2.entry.js → p-ba2833c0.entry.js} +1 -1
- package/dist/vega/{p-13c22d72.entry.js → p-bf4996d5.entry.js} +1 -1
- package/dist/vega/{p-570bdeb5.entry.js → p-cb4fd6e1.entry.js} +1 -1
- package/dist/vega/p-e4ce559d.entry.js +1 -0
- package/dist/vega/{p-cfd486ab.entry.js → p-e9785742.entry.js} +1 -1
- package/dist/vega/p-e9a5bd12.entry.js +1 -0
- package/dist/vega/p-ecaf4cfa.entry.js +1 -0
- package/dist/vega/{p-fb5c2cc6.entry.js → p-ee2e4bff.entry.js} +1 -1
- package/dist/vega/{p-8f8ab0d3.js → p-f86ec91b.js} +1 -1
- package/dist/vega/vega.esm.js +1 -1
- package/package.json +1 -1
- package/dist/types/helpers/formatter/string-formatter/string-format-strategy.d.ts +0 -12
- package/dist/vega/p-34caa637.entry.js +0 -1
- package/dist/vega/p-497db801.entry.js +0 -1
- package/dist/vega/p-4c18ff36.js +0 -1
- package/dist/vega/p-6705ce8f.entry.js +0 -1
- package/dist/vega/p-775fa5dd.entry.js +0 -1
- package/dist/vega/p-98043367.entry.js +0 -1
- package/dist/vega/p-a98475a2.entry.js +0 -1
- package/dist/vega/p-c2ded423.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e,F as t,H as i,r as o,c as a,g as r}from"./p-1c298d5a.js";import{R as n}from"./p-3152031c.js";import{g as s,s as d}from"./p-9b797118.js";import{N as p,O as c}from"./p-b1f65b13.js";import{c as l,M as h,V as b,I as f}from"./p-6e1ab235.js";import{V as m,I as v}from"./p-4387d550.js";import{F as g}from"./p-7da8b05f.js";import{C as x}from"./p-ac608edc.js";import{c as u}from"./p-57669fd6.js";import{k as w,n as y,b as j,c as R,f as I,l as C}from"./p-7c37e5bb.js";import{b as k}from"./p-5dce8dfe.js";import{C as O}from"./p-2d0d575f.js";import{c as D}from"./p-86194314.js";import{D as S}from"./p-d7219734.js";import{e as z}from"./p-fe9644a0.js";import{K as E}from"./p-de25326f.js";import{f as A}from"./p-79ec5d69.js";import{M as V}from"./p-987fbbd0.js";import{T as L}from"./p-a9354a5c.js";import"./p-ed45b3b6.js";import"./p-74168615.js";import"./p-3a0a4d15.js";import"./p-d884c644.js";import"./p-0bb29d98.js";import"./p-331a62d5.js";import"./p-33b62194.js";import"./p-6a334573.js";import"./p-483c483a.js";import"./p-5f589974.js";import"./p-4bcd6612.js";import"./p-b0502d01.js";import"./p-262ec334.js";import"./p-1b860f90.js";import"./p-5f377954.js";import"./p-ff4bafa3.js";import"./p-7a40e033.js";import"./p-112455b1.js";import"./p-6a5a5c7b.js";const T=[{payloadKey:"AUTO_VALIDATION_IS_TRUE",payloadDescription:"Determines whether automatic validation should be implemented when a value is edited in the combo box",payloadValue:e=>!0===e.autoValidation},{payloadKey:"AUTO_VALIDATION_IS_FALSE",payloadDescription:"Determines whether automatic validation should be implemented when a value is edited in the combo box",payloadValue:e=>!1===e.autoValidation}];var F=function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class N extends b{constructor(){super(...arguments),this.onItemClick=async()=>{this.valueController.setValue(await this.dropdownRef.getSelection()),await this.clearInput()},this.onDropdownHide=async()=>{await this.clearInput()},this.onDropdownCreate=async e=>{this.createEventEmit.emit(e),await this.clearInput()},this.onInputChange=async e=>{const t=e.target.value;(this.useDefaultFilter||this.vegaDropdownProps.dynamicOption)&&(await this.dropdownRef.show(),await this.dropdownRef.search(t)),!this.isTemplateMode&&this.useDefaultFilter||this.searchEventEmit.emit(t)}}connectedCallback(){this.isTemplateMode=null!==this.host.querySelector("[slot=items]")}getDropdownRef(){return this.dropdownRef}getSearchInputRef(){return this.searchInputRef}focusInput(){this.searchInputRef.focus()}async hide(){await this.dropdownRef.hide()}async show(){await this.dropdownRef.show()}replaceItemsSlot(e){e&&this.itemsSlotRef&&(this.itemsSlotRef.remove(),this.dropdownRef.append(e))}renderDropdown(){return e("vega-dropdown",Object.assign({trigger:this.disabled?"none":"click",source:this.source,selectType:"multiple",selectedSourceKey:this.value,matchTargetWidth:!0,useDefaultFilter:this.useDefaultFilter},this.vegaDropdownProps,{ref:e=>{this.dropdownRef=e,S.addUniqueObserverToNode(e,w,(async e=>{await this.onDropdownCreate(e.detail)})),S.addUniqueObserverToNode(e,y,(async()=>{await this.onDropdownHide()})),S.addUniqueObserverToNode(e,j,(async()=>{await this.onItemClick()})),S.addUniqueObserverToNode(e,z,(e=>{const t=Array.from(e).filter((e=>!this.source.find((t=>t.key===e.itemKey)))).map((e=>({key:e.itemKey,label:e.label})));this.sourceController.setSource([...this.source,...t])}))}}),this.renderContainer(),this.renderItemsSlot())}renderContainer(){return e("div",{class:{"vega-combo-box-container":!0,[`vega-combo-box-size-${this.size}`]:!0}},this.renderSelectedContainer(),this.renderInputContainer())}renderItemsSlot(){return this.isTemplateMode&&e("div",{slot:"items",ref:e=>{this.itemsSlotRef=e}})}renderSelectedContainer(){const i=this.value.map((e=>this.source.find((t=>t.key===e)))).filter((e=>e));return e(t,null,i.map((e=>this.renderSelectedChip(e))))}renderSelectedChip(t){return e("vega-chip",{key:t.key,text:t.label,variant:"outlined",showCloseIcon:!this.disabled,size:"small",ref:e=>{S.addUniqueObserverToNode(e,R,(async()=>{await this.onChipClose(t.key)}))}})}renderInputContainer(){return e("div",{class:"vega-combo-box-input-container"},e("input",{onInput:this.onInputChange,"aria-label":this.label||"No label defined",placeholder:0===this.value.length?this.placeholder:"",ref:e=>this.searchInputRef=e,onKeyDown:D(),disabled:this.disabled}))}async onChipClose(e){this.valueController.setValue([...this.value.filter((t=>t!==e))]),await this.dropdownRef.hide()}async clearInput(){this.searchInputRef.value="",await this.dropdownRef.search("")}}F([l()],N.prototype,"host",void 0),F([l()],N.prototype,"value",void 0),F([l()],N.prototype,"source",void 0),F([l()],N.prototype,"disabled",void 0),F([l()],N.prototype,"size",void 0),F([l()],N.prototype,"vegaDropdownProps",void 0),F([l()],N.prototype,"label",void 0),F([l()],N.prototype,"placeholder",void 0),F([l()],N.prototype,"useDefaultFilter",void 0),F([l()],N.prototype,"createEventEmit",void 0),F([l()],N.prototype,"searchEventEmit",void 0),F([l()],N.prototype,"valueController",void 0),F([l()],N.prototype,"sourceController",void 0),F([h("connectedCallback")],N.prototype,"connectedCallback",null);class _ extends b{setValue(e){this.value=e}}!function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);r>3&&n&&Object.defineProperty(t,i,n)}([l({writable:!0})],_.prototype,"value",void 0);var K=function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class G extends b{constructor(){super(...arguments),this.onLabelClick=()=>{this.dropdownRenderer.focusInput()}}render(){return e(i,{class:{"vega-combo-box-disabled":this.disabled}},this.renderLabel(),this.dropdownRenderer.renderDropdown(),this.renderHint())}renderLabel(){return e("vega-field-label",{onClick:this.onLabelClick,"is-field-required":this.required,disabled:this.disabled,label:this.label})}renderHint(){return e("div",{class:"vega-combo-box-hint"},this.hint)}}K([l()],G.prototype,"required",void 0),K([l()],G.prototype,"hint",void 0),K([l()],G.prototype,"disabled",void 0),K([l()],G.prototype,"dropdownRenderer",void 0),K([l()],G.prototype,"label",void 0);var H=function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class M extends E{constructor(){super((e=>[{keyCode:"Backspace",activeElementInScope:[e.dropdownRenderer.getSearchInputRef()],eventName:"keydown",callback:e.deleteLastSelectedItem},{keyCode:"ArrowLeft",activeElementInScope:[e.host],callback:()=>e.controlDirectionByKeyboard("ArrowLeft")},{keyCode:"ArrowRight",activeElementInScope:[e.host],callback:()=>e.controlDirectionByKeyboard("ArrowRight")}])),this.deleteLastSelectedItem=()=>{""===this.dropdownRenderer.getSearchInputRef().value&&(this.value.pop(),this.valueController.setValue([...this.value]))}}controlDirectionByKeyboard(e){const t=s();if(t&&t.classList.contains("vega-chip-close-icon")){const i=A(t,"vega-chip");"ArrowLeft"===e&&this.focusItemByKeyboard(i.previousSibling),"ArrowRight"===e&&this.focusItemByKeyboard(i.nextSibling)}else"ArrowLeft"===e&&0===this.dropdownRenderer.getSearchInputRef().selectionStart&&this.focusItemByKeyboard(this.host.shadowRoot.querySelector("vega-chip:last-of-type"))}focusItemByKeyboard(e){e&&(e.classList.contains("vega-combo-box-input-container")?e.querySelector("input").focus():e.shadowRoot.querySelector(".vega-chip-close-icon").focus())}}H([l()],M.prototype,"host",void 0),H([l()],M.prototype,"value",void 0),H([l()],M.prototype,"dropdownRenderer",void 0),H([l()],M.prototype,"valueController",void 0);var P=function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class U extends b{constructor(){super(...arguments),this.mutationObserver=new V({mutationFilter:L("VEGA-DROPDOWN-ITEM"),options:{childList:!0,subtree:!0},callback:()=>this.appendHostItemsToDropdown()})}componentDidLoad(){this.appendHostItemsToDropdown()}appendHostItemsToDropdown(){this.dropdownRenderer.replaceItemsSlot(this.host.querySelector("[slot=items]"))}}P([f()],U.prototype,"mutationObserver",void 0),P([l()],U.prototype,"host",void 0),P([l()],U.prototype,"dropdownRenderer",void 0),P([h("componentDidLoad")],U.prototype,"componentDidLoad",null);class q extends b{setSource(e){this.source=e}}!function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);r>3&&n&&Object.defineProperty(t,i,n)}([l({writable:!0})],q.prototype,"source",void 0);var B=function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};const W=class{constructor(e){o(this,e),this.vegaChange=a(this,"vegaChange",7),this.change=a(this,"change",7),this.vegaCreate=a(this,"vegaCreate",7),this.create=a(this,"create",7),this.vegaSearch=a(this,"vegaSearch",7),this.search=a(this,"search",7),this.globalSlimmers={},this.itemsSlotController=new U,this.keyboardController=new M,this.valueController=new _,this.sourceController=new q,this.renderer=new G,this.dropdownRenderer=new N,this.formFieldController=new g({propertyRules:[{propertyName:"required",ruleFactory:e=>e?new n:null}],validationRulesName:"validationRules",defaultValue:[],attributeGetter:e=>this[e],inputContainerGetter:()=>this.dropdownRenderer.getDropdownRef(),touchableAreaGetter:()=>[this.dropdownRenderer.getSearchInputRef()]}),this.changeEventEmit=u(W,I),this.createEventEmit=u(W,w),this.searchEventEmit=u(W,C),this.dropdownEventPrevent=new x([w,C],(()=>this.dropdownRenderer.getDropdownRef()),{customPreventHandle:e=>{e.stopImmediatePropagation()}}),this.vegaComponentUsageRuntimeMetricsSlimmer=new m(T),this.label="",this.required=!1,this.source=[],this.value=[],this.isValid=null,this.autoValidation=!0,this.validationRules=[],this.disabled=!1,this.placeholder="",this.hint="",this.size="medium",this.vegaDropdownProps={},this.useDefaultFilter=!0}watchSource(){this.source=p(this.source,c)?this.source:[]}watchValue(){this.changeEventEmit.emit(this.value),O.notify(k,{host:this.host,detail:this.value})}watchValidationRules(){}async close(){this.disabled||await this.dropdownRenderer.hide()}async open(){this.disabled||await this.dropdownRenderer.show()}render(){return d(this.renderer.render(),this.host)}get host(){return r(this)}static get watchers(){return{source:["watchSource"],value:["watchValue"],validationRules:["watchValidationRules"]}}};B([v()],W.prototype,"globalSlimmers",void 0),B([f()],W.prototype,"itemsSlotController",void 0),B([f()],W.prototype,"keyboardController",void 0),B([f()],W.prototype,"valueController",void 0),B([f()],W.prototype,"sourceController",void 0),B([f()],W.prototype,"renderer",void 0),B([f()],W.prototype,"dropdownRenderer",void 0),B([f()],W.prototype,"formFieldController",void 0),B([f()],W.prototype,"changeEventEmit",void 0),B([f()],W.prototype,"createEventEmit",void 0),B([f()],W.prototype,"searchEventEmit",void 0),B([f()],W.prototype,"dropdownEventPrevent",void 0),B([f()],W.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),W.style=':host{display:inline-block;width:100%;min-width:0px;text-align:left;line-height:normal}.vega-combo-box-container{border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));padding-left:16px;padding-right:16px;padding-top:12px;padding-bottom:12px;border-radius:8px;gap:8px;display:block;display:flex;flex-wrap:wrap;align-items:center;cursor:pointer}.vega-combo-box-container:hover{border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1))}.vega-combo-box-container:focus-within{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));box-shadow:0 0 0 4px rgba(var(--v-ring-input-focus, 19, 98, 226, 0.25))}.vega-combo-box-container .vega-combo-box-input-container{width:-webkit-min-content;width:-moz-min-content;width:min-content;flex-grow:1}.vega-combo-box-container input{border-style:none;background-color:rgba(var(--v-bg-transparent, 0, 0, 0, 0));font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px;color:rgba(var(--v-text-primary, 32, 54, 69, 1));width:100%}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-combo-box-container input{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-combo-box-container input{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-combo-box-container input{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}.vega-combo-box-container input:focus{outline:2px solid transparent;outline-offset:2px}.vega-combo-box-size-medium{padding-left:12px;padding-right:12px;padding-top:11px;padding-bottom:11px}.vega-combo-box-size-small{padding-left:12px;padding-right:12px;padding-top:7px;padding-bottom:7px}.vega-combo-box-container:focus{outline:none}vega-field-label{margin-bottom:8px}.error .vega-combo-box-container{border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1))}.error .vega-combo-box-container:hover{border:1px solid rgba(var(--v-border-input-field-danger-hover, 255, 87, 114, 1))}.error .vega-combo-box-container:focus-within{border:1px solid rgba(var(--v-border-input-field-danger-focus, 233, 71, 104, 1));box-shadow:0 0 0 4px rgba(var(--v-ring-input-danger-focus, 230, 50, 87, 0.25))}:host(.vega-combo-box-disabled) .vega-combo-box-container{border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1));background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));--tw-shadow:0 0 #0000;box-shadow:rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px}:host(.vega-combo-box-disabled) .vega-combo-box-container:hover{border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}:host(.vega-combo-box-disabled) vega-icon{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}.vega-combo-box-container input::placeholder{color:rgba(var(--v-text-input-placeholder, 176, 180, 181, 1))}.vega-error{display:inline-block;padding-left:8px;padding-right:8px;padding-top:8px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}.vega-hidden{display:none}.vega-combo-box-hint{padding-left:8px;padding-right:8px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1));padding-top:8px}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-combo-box-hint{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-combo-box-hint{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-combo-box-hint{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}.vega-error:not(.vega-hidden)+.vega-combo-box-hint{padding-top:4px}vega-dropdown{display:block}';export{W as vega_combo_box}
|
|
1
|
+
import{h as e,F as t,H as i,r as o,c as a,g as r}from"./p-1c298d5a.js";import{R as n}from"./p-3152031c.js";import{g as s,s as d}from"./p-9b797118.js";import{N as p,O as c}from"./p-b1f65b13.js";import{c as l,M as h,V as b,I as f}from"./p-6e1ab235.js";import{V as m,I as v}from"./p-4387d550.js";import{F as g}from"./p-b517ed15.js";import{C as x}from"./p-ac608edc.js";import{c as u}from"./p-57669fd6.js";import{k as w,n as y,b as j,c as R,f as I,l as C}from"./p-7c37e5bb.js";import{b as k}from"./p-5dce8dfe.js";import{C as O}from"./p-2d0d575f.js";import{c as D}from"./p-86194314.js";import{D as S}from"./p-d7219734.js";import{e as z}from"./p-348e95ba.js";import{K as E}from"./p-de25326f.js";import{f as A}from"./p-79ec5d69.js";import{M as V}from"./p-987fbbd0.js";import{T as L}from"./p-a9354a5c.js";import"./p-ed45b3b6.js";import"./p-74168615.js";import"./p-3a0a4d15.js";import"./p-d884c644.js";import"./p-0bb29d98.js";import"./p-331a62d5.js";import"./p-33b62194.js";import"./p-6a334573.js";import"./p-483c483a.js";import"./p-5f589974.js";import"./p-4bcd6612.js";import"./p-b0502d01.js";import"./p-262ec334.js";import"./p-1b860f90.js";import"./p-5f377954.js";import"./p-ff4bafa3.js";import"./p-7a40e033.js";import"./p-112455b1.js";import"./p-6a5a5c7b.js";const T=[{payloadKey:"AUTO_VALIDATION_IS_TRUE",payloadDescription:"Determines whether automatic validation should be implemented when a value is edited in the combo box",payloadValue:e=>!0===e.autoValidation},{payloadKey:"AUTO_VALIDATION_IS_FALSE",payloadDescription:"Determines whether automatic validation should be implemented when a value is edited in the combo box",payloadValue:e=>!1===e.autoValidation}];var F=function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class N extends b{constructor(){super(...arguments),this.onItemClick=async()=>{this.valueController.setValue(await this.dropdownRef.getSelection()),await this.clearInput()},this.onDropdownHide=async()=>{await this.clearInput()},this.onDropdownCreate=async e=>{this.createEventEmit.emit(e),await this.clearInput()},this.onInputChange=async e=>{const t=e.target.value;(this.useDefaultFilter||this.vegaDropdownProps.dynamicOption)&&(await this.dropdownRef.show(),await this.dropdownRef.search(t)),!this.isTemplateMode&&this.useDefaultFilter||this.searchEventEmit.emit(t)}}connectedCallback(){this.isTemplateMode=null!==this.host.querySelector("[slot=items]")}getDropdownRef(){return this.dropdownRef}getSearchInputRef(){return this.searchInputRef}focusInput(){this.searchInputRef.focus()}async hide(){await this.dropdownRef.hide()}async show(){await this.dropdownRef.show()}replaceItemsSlot(e){e&&this.itemsSlotRef&&(this.itemsSlotRef.remove(),this.dropdownRef.append(e))}renderDropdown(){return e("vega-dropdown",Object.assign({trigger:this.disabled?"none":"click",source:this.source,selectType:"multiple",selectedSourceKey:this.value,matchTargetWidth:!0,useDefaultFilter:this.useDefaultFilter},this.vegaDropdownProps,{ref:e=>{this.dropdownRef=e,S.addUniqueObserverToNode(e,w,(async e=>{await this.onDropdownCreate(e.detail)})),S.addUniqueObserverToNode(e,y,(async()=>{await this.onDropdownHide()})),S.addUniqueObserverToNode(e,j,(async()=>{await this.onItemClick()})),S.addUniqueObserverToNode(e,z,(e=>{const t=Array.from(e).filter((e=>!this.source.find((t=>t.key===e.itemKey)))).map((e=>({key:e.itemKey,label:e.label})));this.sourceController.setSource([...this.source,...t])}))}}),this.renderContainer(),this.renderItemsSlot())}renderContainer(){return e("div",{class:{"vega-combo-box-container":!0,[`vega-combo-box-size-${this.size}`]:!0}},this.renderSelectedContainer(),this.renderInputContainer())}renderItemsSlot(){return this.isTemplateMode&&e("div",{slot:"items",ref:e=>{this.itemsSlotRef=e}})}renderSelectedContainer(){const i=this.value.map((e=>this.source.find((t=>t.key===e)))).filter((e=>e));return e(t,null,i.map((e=>this.renderSelectedChip(e))))}renderSelectedChip(t){return e("vega-chip",{key:t.key,text:t.label,variant:"outlined",showCloseIcon:!this.disabled,size:"small",ref:e=>{S.addUniqueObserverToNode(e,R,(async()=>{await this.onChipClose(t.key)}))}})}renderInputContainer(){return e("div",{class:"vega-combo-box-input-container"},e("input",{onInput:this.onInputChange,"aria-label":this.label||"No label defined",placeholder:0===this.value.length?this.placeholder:"",ref:e=>this.searchInputRef=e,onKeyDown:D(),disabled:this.disabled}))}async onChipClose(e){this.valueController.setValue([...this.value.filter((t=>t!==e))]),await this.dropdownRef.hide()}async clearInput(){this.searchInputRef.value="",await this.dropdownRef.search("")}}F([l()],N.prototype,"host",void 0),F([l()],N.prototype,"value",void 0),F([l()],N.prototype,"source",void 0),F([l()],N.prototype,"disabled",void 0),F([l()],N.prototype,"size",void 0),F([l()],N.prototype,"vegaDropdownProps",void 0),F([l()],N.prototype,"label",void 0),F([l()],N.prototype,"placeholder",void 0),F([l()],N.prototype,"useDefaultFilter",void 0),F([l()],N.prototype,"createEventEmit",void 0),F([l()],N.prototype,"searchEventEmit",void 0),F([l()],N.prototype,"valueController",void 0),F([l()],N.prototype,"sourceController",void 0),F([h("connectedCallback")],N.prototype,"connectedCallback",null);class _ extends b{setValue(e){this.value=e}}!function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);r>3&&n&&Object.defineProperty(t,i,n)}([l({writable:!0})],_.prototype,"value",void 0);var K=function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class G extends b{constructor(){super(...arguments),this.onLabelClick=()=>{this.dropdownRenderer.focusInput()}}render(){return e(i,{class:{"vega-combo-box-disabled":this.disabled}},this.renderLabel(),this.dropdownRenderer.renderDropdown(),this.renderHint())}renderLabel(){return e("vega-field-label",{onClick:this.onLabelClick,"is-field-required":this.required,disabled:this.disabled,label:this.label})}renderHint(){return e("div",{class:"vega-combo-box-hint"},this.hint)}}K([l()],G.prototype,"required",void 0),K([l()],G.prototype,"hint",void 0),K([l()],G.prototype,"disabled",void 0),K([l()],G.prototype,"dropdownRenderer",void 0),K([l()],G.prototype,"label",void 0);var H=function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class M extends E{constructor(){super((e=>[{keyCode:"Backspace",activeElementInScope:[e.dropdownRenderer.getSearchInputRef()],eventName:"keydown",callback:e.deleteLastSelectedItem},{keyCode:"ArrowLeft",activeElementInScope:[e.host],callback:()=>e.controlDirectionByKeyboard("ArrowLeft")},{keyCode:"ArrowRight",activeElementInScope:[e.host],callback:()=>e.controlDirectionByKeyboard("ArrowRight")}])),this.deleteLastSelectedItem=()=>{""===this.dropdownRenderer.getSearchInputRef().value&&(this.value.pop(),this.valueController.setValue([...this.value]))}}controlDirectionByKeyboard(e){const t=s();if(t&&t.classList.contains("vega-chip-close-icon")){const i=A(t,"vega-chip");"ArrowLeft"===e&&this.focusItemByKeyboard(i.previousSibling),"ArrowRight"===e&&this.focusItemByKeyboard(i.nextSibling)}else"ArrowLeft"===e&&0===this.dropdownRenderer.getSearchInputRef().selectionStart&&this.focusItemByKeyboard(this.host.shadowRoot.querySelector("vega-chip:last-of-type"))}focusItemByKeyboard(e){e&&(e.classList.contains("vega-combo-box-input-container")?e.querySelector("input").focus():e.shadowRoot.querySelector(".vega-chip-close-icon").focus())}}H([l()],M.prototype,"host",void 0),H([l()],M.prototype,"value",void 0),H([l()],M.prototype,"dropdownRenderer",void 0),H([l()],M.prototype,"valueController",void 0);var P=function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};class U extends b{constructor(){super(...arguments),this.mutationObserver=new V({mutationFilter:L("VEGA-DROPDOWN-ITEM"),options:{childList:!0,subtree:!0},callback:()=>this.appendHostItemsToDropdown()})}componentDidLoad(){this.appendHostItemsToDropdown()}appendHostItemsToDropdown(){this.dropdownRenderer.replaceItemsSlot(this.host.querySelector("[slot=items]"))}}P([f()],U.prototype,"mutationObserver",void 0),P([l()],U.prototype,"host",void 0),P([l()],U.prototype,"dropdownRenderer",void 0),P([h("componentDidLoad")],U.prototype,"componentDidLoad",null);class q extends b{setSource(e){this.source=e}}!function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);r>3&&n&&Object.defineProperty(t,i,n)}([l({writable:!0})],q.prototype,"source",void 0);var B=function(e,t,i,o){var a,r=arguments.length,n=r<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var s=e.length-1;s>=0;s--)(a=e[s])&&(n=(r<3?a(n):r>3?a(t,i,n):a(t,i))||n);return r>3&&n&&Object.defineProperty(t,i,n),n};const W=class{constructor(e){o(this,e),this.vegaChange=a(this,"vegaChange",7),this.change=a(this,"change",7),this.vegaCreate=a(this,"vegaCreate",7),this.create=a(this,"create",7),this.vegaSearch=a(this,"vegaSearch",7),this.search=a(this,"search",7),this.globalSlimmers={},this.itemsSlotController=new U,this.keyboardController=new M,this.valueController=new _,this.sourceController=new q,this.renderer=new G,this.dropdownRenderer=new N,this.formFieldController=new g({propertyRules:[{propertyName:"required",ruleFactory:e=>e?new n:null}],validationRulesName:"validationRules",defaultValue:[],attributeGetter:e=>this[e],inputContainerGetter:()=>this.dropdownRenderer.getDropdownRef(),touchableAreaGetter:()=>[this.dropdownRenderer.getSearchInputRef()]}),this.changeEventEmit=u(W,I),this.createEventEmit=u(W,w),this.searchEventEmit=u(W,C),this.dropdownEventPrevent=new x([w,C],(()=>this.dropdownRenderer.getDropdownRef()),{customPreventHandle:e=>{e.stopImmediatePropagation()}}),this.vegaComponentUsageRuntimeMetricsSlimmer=new m(T),this.label="",this.required=!1,this.source=[],this.value=[],this.isValid=null,this.autoValidation=!0,this.validationRules=[],this.disabled=!1,this.placeholder="",this.hint="",this.size="medium",this.vegaDropdownProps={},this.useDefaultFilter=!0}watchSource(){this.source=p(this.source,c)?this.source:[]}watchValue(){this.changeEventEmit.emit(this.value),O.notify(k,{host:this.host,detail:this.value})}watchValidationRules(){}async close(){this.disabled||await this.dropdownRenderer.hide()}async open(){this.disabled||await this.dropdownRenderer.show()}render(){return d(this.renderer.render(),this.host)}get host(){return r(this)}static get watchers(){return{source:["watchSource"],value:["watchValue"],validationRules:["watchValidationRules"]}}};B([v()],W.prototype,"globalSlimmers",void 0),B([f()],W.prototype,"itemsSlotController",void 0),B([f()],W.prototype,"keyboardController",void 0),B([f()],W.prototype,"valueController",void 0),B([f()],W.prototype,"sourceController",void 0),B([f()],W.prototype,"renderer",void 0),B([f()],W.prototype,"dropdownRenderer",void 0),B([f()],W.prototype,"formFieldController",void 0),B([f()],W.prototype,"changeEventEmit",void 0),B([f()],W.prototype,"createEventEmit",void 0),B([f()],W.prototype,"searchEventEmit",void 0),B([f()],W.prototype,"dropdownEventPrevent",void 0),B([f()],W.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),W.style=':host{display:inline-block;width:100%;min-width:0px;text-align:left;line-height:normal}.vega-combo-box-container{border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));padding-left:16px;padding-right:16px;padding-top:12px;padding-bottom:12px;border-radius:8px;gap:8px;display:block;display:flex;flex-wrap:wrap;align-items:center;cursor:pointer}.vega-combo-box-container:hover{border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1))}.vega-combo-box-container:focus-within{border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));box-shadow:0 0 0 4px rgba(var(--v-ring-input-focus, 19, 98, 226, 0.25))}.vega-combo-box-container .vega-combo-box-input-container{width:-webkit-min-content;width:-moz-min-content;width:min-content;flex-grow:1}.vega-combo-box-container input{border-style:none;background-color:rgba(var(--v-bg-transparent, 0, 0, 0, 0));font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px;color:rgba(var(--v-text-primary, 32, 54, 69, 1));width:100%}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-combo-box-container input{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-combo-box-container input{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-combo-box-container input{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}.vega-combo-box-container input:focus{outline:2px solid transparent;outline-offset:2px}.vega-combo-box-size-medium{padding-left:12px;padding-right:12px;padding-top:11px;padding-bottom:11px}.vega-combo-box-size-small{padding-left:12px;padding-right:12px;padding-top:7px;padding-bottom:7px}.vega-combo-box-container:focus{outline:none}vega-field-label{margin-bottom:8px}.error .vega-combo-box-container{border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1))}.error .vega-combo-box-container:hover{border:1px solid rgba(var(--v-border-input-field-danger-hover, 255, 87, 114, 1))}.error .vega-combo-box-container:focus-within{border:1px solid rgba(var(--v-border-input-field-danger-focus, 233, 71, 104, 1));box-shadow:0 0 0 4px rgba(var(--v-ring-input-danger-focus, 230, 50, 87, 0.25))}:host(.vega-combo-box-disabled) .vega-combo-box-container{border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1));background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));--tw-shadow:0 0 #0000;box-shadow:rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px, rgba(0, 0, 0, 0) 0px 0px 0px 0px}:host(.vega-combo-box-disabled) .vega-combo-box-container:hover{border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}:host(.vega-combo-box-disabled) vega-icon{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}.vega-combo-box-container input::placeholder{color:rgba(var(--v-text-input-placeholder, 176, 180, 181, 1))}.vega-error{display:inline-block;padding-left:8px;padding-right:8px;padding-top:8px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}.vega-hidden{display:none}.vega-combo-box-hint{padding-left:8px;padding-right:8px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1));padding-top:8px}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-combo-box-hint{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-combo-box-hint{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-combo-box-hint{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}.vega-error:not(.vega-hidden)+.vega-combo-box-hint{padding-top:4px}vega-dropdown{display:block}';export{W as vega_combo_box}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as i,h as t,H as a,g as r}from"./p-1c298d5a.js";import{c as n}from"./p-86194314.js";import{s as o}from"./p-9b797118.js";import{C as s}from"./p-2d0d575f.js";import{C as c,b as h,h as l}from"./p-5dce8dfe.js";import{O as d}from"./p-331a62d5.js";import{f as p}from"./p-79ec5d69.js";import{c as g,M as b,V as x,I as v}from"./p-6e1ab235.js";import{V as f,I as m}from"./p-4387d550.js";import{F as u}from"./p-b517ed15.js";import{c as k}from"./p-57669fd6.js";import{d as w,f as y}from"./p-7c37e5bb.js";import{c as j}from"./p-348e95ba.js";import{C}from"./p-ac608edc.js";import{R as I}from"./p-3152031c.js";import{C as z}from"./p-ed4a57a8.js";import{C as R}from"./p-60fb1db7.js";import"./p-0bb29d98.js";import"./p-33b62194.js";import"./p-6a334573.js";import"./p-483c483a.js";import"./p-5f589974.js";import"./p-4bcd6612.js";import"./p-74168615.js";import"./p-ed45b3b6.js";import"./p-d7219734.js";import"./p-987fbbd0.js";import"./p-a9354a5c.js";import"./p-b0502d01.js";import"./p-262ec334.js";import"./p-1b860f90.js";import"./p-5f377954.js";import"./p-ff4bafa3.js";import"./p-7a40e033.js";import"./p-112455b1.js";class V{evaluate(e){return"boolean"==typeof e?{isValid:e,message:e?"":"This field is required"}:"string"==typeof e?{isValid:""!==e,message:""!==e?"":"This field is required"}:{isValid:!1,message:"This field is required"}}canEvaluate(e,i){return i?this.isAcceptedInputType(e)&&!i.disabled&&i.visible:this.isAcceptedInputType(e)}shouldShowError(e){return!e.disabled&&e.visible&&(e.touched||e.modified)}isAcceptedInputType(e){return"string"==typeof e||"boolean"==typeof e||null===e}}var D=function(e,i,t,a){var r,n=arguments.length,o=n<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,t):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,i,t,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(n<3?r(o):n>3?r(i,t,o):r(i,t))||o);return n>3&&o&&Object.defineProperty(i,t,o),o};class O extends x{connectedCallback(){this.checkboxGroup=p(this.host,"vega-checkbox-group")||p(this.host,"vega-selection-tile-group"),this.fieldErrorObserver=new d(this.canAcceptFieldErrorObserver.bind(this),this.fieldErrorObserverListener.bind(this)),s.register(w.getSubject(this.checkboxGroup||this.host,j),this.fieldErrorObserver)}disconnectedCallback(){s.unregister(w.getSubject(this.checkboxGroup||this.host,j),this.fieldErrorObserver)}canAcceptFieldErrorObserver(){return!0}fieldErrorObserverListener(e){this.showError=e.showError}}D([g({writable:!0})],O.prototype,"showError",void 0),D([g()],O.prototype,"host",void 0),D([b("connectedCallback")],O.prototype,"connectedCallback",null),D([b("disconnectedCallback")],O.prototype,"disconnectedCallback",null);var E=function(e,i,t,a){var r,n=arguments.length,o=n<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,t):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,i,t,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(n<3?r(o):n>3?r(i,t,o):r(i,t))||o);return n>3&&o&&Object.defineProperty(i,t,o),o};const G=class{constructor(t){e(this,t),this.vegaChange=i(this,"vegaChange",7),this.change=i(this,"change",7),this.globalSlimmers={},this.vegaCheckboxShowErrorController=new O,this.formFieldController=new u({propertyRules:[{propertyName:"required",ruleFactory:e=>e?new V:null}],defaultValue:e=>""!==e.identifier&&"",attributeGetter:e=>this[e],inputContainerGetter:()=>this.inputContainerRef,touchableAreaGetter:()=>[this.inputRef]}),this.changeEventEmitter=k(G,y),this.dropdownEventPrevent=new C([y],(()=>this.host),{customPreventHandle:e=>{e.stopPropagation()}}),this.vegaComponentUsageRuntimeMetricsSlimmer=new f,this.groupDisabled=!1,this.showError=!1,this.identifier="",this.value=""!==this.identifier&&"",this.checked=!1,this.disabled=!1,this.size="default",this.required=!1,this.isValid=null,this.onCheckBoxChange=e=>{this.checked=e.currentTarget.checked},this.onSelectedIconClick=e=>{e.stopPropagation()}}watchCheckedChange(){this.initValue(),this.changeEventEmitter.emit(this.value),s.notify(c,{host:this.host,detail:this.value}),s.notify(h,{host:this.host,detail:this.value})}disconnectedCallback(){this.unRegisterGroupDisabledObserver()}componentWillLoad(){this.initValue(),this.initAndRegisterGroupDisabledObserver()}componentDidRender(){""===this.host.innerHTML.trim()&&this.labelElement.classList.add("vega-hidden")}async setValue(e){this.checked=this.identifier?e===this.identifier:!0===e}render(){return o(t(a,{class:{"vega-flex-shrink-0 v-min-w-min":"VEGA-CHECKBOX-GROUP"==this.host.parentElement.nodeName,checked:this.checked,disabled:this.isDisabled()}},t("label",{class:{"vega-checkbox-container":!0,error:this.showError},ref:e=>this.inputContainerRef=e},t("input",{ref:e=>this.inputRef=e,type:"checkbox",checked:this.checked,value:this.identifier,onChange:this.onCheckBoxChange,"aria-label":this.identifier||"No label defined",disabled:this.isDisabled(),role:"button",tabIndex:0,onKeyDown:n()}),t("span",{class:{"vega-checkbox-icon":!0,"vega-checkbox-small":"small"===this.size},onClick:this.onSelectedIconClick,tabIndex:-1},this.renderIconDom()),t("div",{class:{"vega-checkbox-label-container":!0,"vega-checkbox-label-small":"small"===this.size},ref:e=>this.labelElement=e},this.renderLabelDom(),this.renderRequireDom()))),this.host)}renderIconDom(){return this.checked?t("vega-icon",{icon:"checkmark",size:"small"===this.size?"size-12":"size-16"}):null}renderLabelDom(){return t("span",{class:"vega-checkbox-label"},t("slot",null))}renderRequireDom(){return t("span",{class:{"vega-require":this.required}},this.required?"*":"")}initValue(){this.value=""!==this.identifier?this.checked?this.identifier:"":this.checked}isDisabled(){return this.disabled||this.groupDisabled}canAcceptGroupDisabledObserver(e){return p(this.host,"vega-checkbox-group")===e.host}groupDisabledObserverListener(e){this.groupDisabled=e.host.disabled}initAndRegisterGroupDisabledObserver(){p(this.host,"vega-checkbox-group")&&(this.groupDisabledObserver=new d(this.canAcceptGroupDisabledObserver.bind(this),this.groupDisabledObserverListener.bind(this)),s.register(l,this.groupDisabledObserver))}unRegisterGroupDisabledObserver(){this.groupDisabledObserver&&s.unregister(l,this.groupDisabledObserver)}get host(){return r(this)}static get watchers(){return{checked:["watchCheckedChange"]}}};E([m()],G.prototype,"globalSlimmers",void 0),E([v()],G.prototype,"vegaCheckboxShowErrorController",void 0),E([v()],G.prototype,"formFieldController",void 0),E([v()],G.prototype,"changeEventEmitter",void 0),E([v()],G.prototype,"dropdownEventPrevent",void 0),E([v()],G.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),G.style=':host{display:inline-block;vertical-align:middle}.vega-checkbox-container{position:relative;display:flex;-webkit-tap-highlight-color:transparent}.vega-checkbox-container>input[type=checkbox]{position:absolute;left:0px;top:0px;opacity:0;width:24px;height:24px;padding:0px;margin:0px}.vega-checkbox-container>.vega-checkbox-icon{display:inline-block;box-sizing:border-box;width:24px;height:24px;border-style:solid;border-width:2px;border-color:rgba(var(--v-border-color-action-active, 29, 65, 195, 1));position:relative;left:0px;background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));border:1px solid rgba(var(--v-border-input-field, 171, 198, 216, 1));border-radius:4px;min-width:24px;color:rgba(var(--v-text-inverted-primary, 252, 252, 252, 1))}.vega-checkbox-container>.vega-checkbox-icon.vega-checkbox-small{width:16px;height:16px;min-width:16px;border-radius:2px}.vega-checkbox-container>.vega-checkbox-icon:hover{border:1px solid rgba(var(--v-border-input-field-hover, 115, 160, 190, 1))}:host(.checked) .vega-checkbox-container>.vega-checkbox-icon{background-color:rgba(var(--v-bg-action, 19, 98, 226, 1))}:host(.checked) .vega-checkbox-container>.vega-checkbox-icon:hover{background-color:rgba(var(--v-bg-action-hover, 4, 112, 236, 1))}.vega-checkbox-container>input[type=checkbox]:focus-visible+.vega-checkbox-icon{box-shadow:0 0 0 4px rgba(var(--v-ring-input-focus, 19, 98, 226, 0.25));border:1px solid rgba(var(--v-border-input-field-focus, 19, 98, 226, 1));outline:none}.vega-checkbox-container>.vega-checkbox-icon:active{border-width:1px;border-style:solid;border-color:rgba(var(--v-border-color-action-active, 29, 65, 195, 1))}:host(.checked) .vega-checkbox-container>.vega-checkbox-icon:active{background-color:rgba(var(--v-bg-action-active, 29, 65, 195, 1))}:host(.checked) .vega-checkbox-container>.vega-checkbox-icon{display:inline-flex;align-items:center;justify-content:center}:host(.disabled) .vega-checkbox-container{cursor:not-allowed}:host(:not(.disabled)) .vega-checkbox-container{cursor:pointer}.vega-checkbox-container .vega-require{color:rgba(var(--v-text-error, 189, 41, 71, 1));margin-left:4px;vertical-align:middle}.vega-checkbox-container.error>.vega-checkbox-icon{background-color:rgba(var(--v-bg-primary, 252, 252, 252, 1));border:1px solid rgba(var(--v-border-input-field-danger, 230, 50, 87, 1))}:host(.checked) .vega-checkbox-container.error>.vega-checkbox-icon{background-color:rgba(var(--v-bg-danger, 189, 41, 71, 1))}.vega-checkbox-container.error>.vega-checkbox-icon:hover{border:1px solid rgba(var(--v-border-input-field-danger-hover, 255, 87, 114, 1))}:host(.checked) .vega-checkbox-container.error>.vega-checkbox-icon:hover{background-color:rgba(var(--v-bg-danger-hover, 233, 71, 104, 1))}.vega-checkbox-container.error>input[type=checkbox]:focus-visible+.vega-checkbox-icon{box-shadow:0 0 0 4px rgba(var(--v-ring-input-danger-focus, 230, 50, 87, 0.25));border:1px solid rgba(var(--v-border-input-field-danger-focus, 233, 71, 104, 1));outline:none}:host(.checked) .vega-checkbox-container.error>.vega-checkbox-icon:active{background-color:rgba(var(--v-bg-danger-active, 230, 50, 87, 1))}.vega-checkbox-container.error>.vega-checkbox-icon:active{border-width:1px;border-style:solid;border-color:rgba(var(--v-border-color-danger-active, 189, 41, 71, 1))}:host(.disabled) .vega-checkbox-container>.vega-checkbox-icon{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}:host(.checked.disabled) .vega-checkbox-container>.vega-checkbox-icon{background-color:rgba(var(--v-bg-disabled, 176, 180, 181, 1));border:1px solid rgba(var(--v-border-input-field-disabled, 222, 225, 227, 1))}:host(.checked.disabled) .vega-checkbox-container>.vega-checkbox-icon>vega-icon{color:rgba(var(--v-text-inverted-primary, 252, 252, 252, 1))}.vega-checkbox-container>.vega-checkbox-label-container{display:inline-block;margin-left:12px;color:rgba(var(--v-text-primary, 32, 54, 69, 1));font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-checkbox-container>.vega-checkbox-label-container{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-checkbox-container>.vega-checkbox-label-container{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-checkbox-container>.vega-checkbox-label-container{font-family:"Inter", sans-serif;font-size:16px;font-weight:400;line-height:24px;letter-spacing:0px}}.vega-checkbox-container>.vega-checkbox-label-container.vega-checkbox-label-small{margin-left:8px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-checkbox-container>.vega-checkbox-label-container.vega-checkbox-label-small{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-checkbox-container>.vega-checkbox-label-container.vega-checkbox-label-small{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-checkbox-container>.vega-checkbox-label-container.vega-checkbox-label-small{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px}}:host(.disabled) .vega-checkbox-container>.vega-checkbox-label-container{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}.vega-error{display:block;margin-top:12px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}.vega-checkbox-label-container.vega-hidden{display:none}.vega-hidden{display:none}';var q=function(e,i,t,a){var r,n=arguments.length,o=n<3?i:null===a?a=Object.getOwnPropertyDescriptor(i,t):a;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,i,t,a);else for(var s=e.length-1;s>=0;s--)(r=e[s])&&(o=(n<3?r(o):n>3?r(i,t,o):r(i,t))||o);return n>3&&o&&Object.defineProperty(i,t,o),o};const F=class{constructor(t){e(this,t),this.vegaChange=i(this,"vegaChange",7),this.change=i(this,"change",7),this.globalSlimmers={},this.formFieldController=new u({propertyRules:[{propertyName:"required",ruleFactory:e=>e?new I:null}],defaultValue:[],validationRulesName:"validationRules",attributeGetter:e=>this[e],inputContainerGetter:()=>this.inputContainerRef,touchableAreaGetter:()=>this.touchableAreaGetter()}),this.checkboxValueChangeObserver=new R(c,(e=>this.childCheckboxValueChange(e))),this.checkboxEventPrevent=new C([y],(()=>this.vegaFlexElement)),this.changeEventEmitter=k(F,y),this.vegaComponentUsageRuntimeMetricsSlimmer=new f,this.label="",this.value=[],this.vegaFlexProp={},this.disabled=!1,this.required=!1,this.hint="",this.isValid=null,this.autoValidation=!0,this.validationRules=[],this.childCheckboxValueChange=e=>{this.syncCheckboxItemsValue(e.detail,e.host.identifier)},this.touchableAreaGetter=()=>{const e=[];return this.vegaCheckboxArray&&this.vegaCheckboxArray.forEach((async i=>{e.push(i.shadowRoot.querySelector("input"))})),e}}async watchValue(){this.initCheckboxArray(),this.changeEventEmitter.emit(this.value),s.notify(h,{host:this.host,detail:this.value})}watchVegaFlexProp(){this.setVegaFlexProperty()}async watchDisabled(){this.notifyGroupDisabledChange()}watchValidationRules(){}componentDidLoad(){this.setVegaFlexProperty(),this.initCheckboxArray(),this.notifyGroupDisabledChange()}render(){return o(t(a,null,this.renderLabelDom(),t("div",{class:"vega-checkbox-group-container",ref:e=>this.inputContainerRef=e},t("vega-flex",{ref:e=>{this.vegaFlexElement=e}},t("slot",null))),this.renderHintDom()),this.host)}renderLabelDom(){return this.label&&t("div",{class:"vega-label"},t("label",{"aria-label":this.label},this.label,this.renderRequireDom()))}renderRequireDom(){return this.required?t("span",{class:"vega-require"},"*"):null}renderHintDom(){return this.hint&&t("div",{class:"vega-hint"},t("label",null,this.hint))}setVegaFlexProperty(){this.vegaFlexProp&&Object.assign(this.vegaFlexElement,{gap:"size-16",direction:"col"},this.vegaFlexProp)}syncCheckboxItemsValue(e,i){e&&!this.value.includes(i)?this.value=[...this.value,i]:!e&&this.value.includes(i)&&(this.value=[...this.value.filter((e=>e!==i))])}initCheckboxArray(){this.vegaCheckboxArray=Array.from(this.host.querySelectorAll("vega-checkbox")),this.vegaCheckboxArray.forEach((e=>{e.checked=!!(this.value&&this.value.length>0)&&this.value.includes(e.identifier)}))}notifyGroupDisabledChange(){s.notify(l,{host:this.host})}get host(){return r(this)}static get watchers(){return{value:["watchValue"],vegaFlexProp:["watchVegaFlexProp"],disabled:["watchDisabled"],validationRules:["watchValidationRules"]}}};q([m()],F.prototype,"globalSlimmers",void 0),q([v()],F.prototype,"formFieldController",void 0),q([v()],F.prototype,"checkboxValueChangeObserver",void 0),q([v()],F.prototype,"checkboxEventPrevent",void 0),q([v()],F.prototype,"changeEventEmitter",void 0),q([v()],F.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),q([z()],F.prototype,"watchVegaFlexProp",null),F.style=':host{display:block;text-align:left;line-height:normal}.vega-error{display:block;margin-top:12px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}.vega-hidden{display:none}.vega-label{margin-bottom:16px}.vega-label label{font-family:"Inter", sans-serif;font-size:18px;font-weight:500;line-height:30px;letter-spacing:0px;color:rgba(var(--v-text-primary, 32, 54, 69, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-label label{font-family:"Inter", sans-serif;font-size:16px;font-weight:500;line-height:28px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-label label{font-family:"Inter", sans-serif;font-size:16px;font-weight:500;line-height:28px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-label label{font-family:"Inter", sans-serif;font-size:16px;font-weight:500;line-height:28px;letter-spacing:0px}}.vega-require{color:rgba(var(--v-text-error, 189, 41, 71, 1));margin-left:4px}.vega-hint{padding-top:12px}.vega-hint>label{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-secondary, 107, 116, 125, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){.vega-hint>label{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){.vega-hint>label{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){.vega-hint>label{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}';export{G as vega_checkbox,F as vega_checkbox_group}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{B as t,a as s,M as e,b as i,s as n,N as r,c as h,R as o,d as a,A as c,I as u,V as l}from"./p-2d36dbfe.js";import{C as d}from"./p-2d0d575f.js";import{d as p}from"./p-7c37e5bb.js";import{V as f,b as w}from"./p-fe9644a0.js";import{i as b}from"./p-b1f65b13.js";import"./p-6e1ab235.js";import{g as k}from"./p-33b62194.js";class m extends t{constructor(t){super(),this.type=s.ALIGNMENT,this.textAlign=t}static from(t){return[s.ALIGNMENT,new m(t)]}toJSON(){return{textAlign:this.textAlign}}renderClass(){return`v-rte--horizontal-alignment-${this.textAlign}`}render(){return null}}class g extends t{constructor(t){super(),this.type=s.INDENT,this.indent=Math.max(0,t)}static from(t){return[s.INDENT,new g(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}render(){return this.indent>0?{"margin-left":16*this.indent+"px"}:null}}class x{replaceBlockWithBlocks(t,s){this.blocks&&(s.forEach((t=>{t.parent=this})),this.blocks=this.blocks.flatMap((e=>e===t?s:e)))}appendChildBlocks(t){this.blocks&&(t.forEach((t=>{t.parent=this})),this.blocks=this.blocks.concat(t))}removeChildBlock(t){this.blocks&&(this.blocks=this.blocks.filter((s=>s!==t)))}}class y extends e{constructor(t){super(),this.type=i.APPEND_CHILD_NODES,this.entityToBeAppended=t}}class N extends e{constructor(t){super(),this.type=i.DELETE_CHILD,this.entityToBeRemoved=t}}const O=[{key:"black",light:"#111128",dark:"#E3E3E8"},{key:"gray",light:"#5E5E6D",dark:"#B9B9C1"},{key:"green",light:"#01801F",dark:"#59D977"},{key:"red",light:"#BD2947",dark:"#FFB2B5"},{key:"purple",light:"#563D82",dark:"#BEB2FF"},{key:"teal",light:"#17758F",dark:"#4CD8FF"}],A="";class S extends x{constructor(t){super(),this.annotationMap=new Map,this.id=t}static createAnnotationEntity(t,s){switch(t){case"textAlign":return m.from(s);case"indent":return g.from(s)}}toJSON(){const s=Array.from(this.annotationMap.values()).filter((s=>s instanceof t)).reduce(((t,s)=>Object.assign(Object.assign({},t),s.toJSON())),{});return Object.assign({id:this.id},Object.keys(s).length>0?{annotations:s}:{})}getAnnotationByType(t){return this.annotationMap.get(t)}apply(t){if(this.doApply(t),t.isFlushable){const t=n.getDOMByEntity(this);if(t){const s=p.getSubjectFromParentNodeByEventId(t,f);s&&d.notify(s,{})}}}doApply(t){t instanceof e?this.doModifyActionApply(t):this.applyAnnotationAction(t)}applyAnnotationAction(t){const s=t.toAnnotation();this.annotationMap.set(s.type,s),"function"==typeof this.doAnnotationActionApply&&this.doAnnotationActionApply(t)}appendChildNodes(t){t.forEach((t=>{t.parentBlock=this})),this.nodes=this.nodes.concat(t)}mergeTwoBlocksNodes(t){if(this.type===t.type||"image"!==this.type&&"image"!==t.type){let s=t.nodes;"image"!==this.type&&(s=t.nodes.filter((t=>t.text&&""!==t.text))),this.apply(new y(s)),t.parent.apply(new N(t))}}concatBlocksNodes(t){const s=[];return t.map((t=>{"image"!==t.type&&(s.push(...t.nodes),t.parent.apply(new N(t)))})),s}getPreviousNode(t){const s=t.parentBlock,e=s.nodes.indexOf(t);if(e>0)return s.nodes[e-1];if(s.parent){const t=this.getPreviousBlock(s);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const s=t.parentBlock,e=s.nodes.indexOf(t);if(s.nodes[e+1])return s.nodes[e+1];if(s.parent){const t=this.getNextBlock(s);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const s=t.parentBlock,e=s.nodes.indexOf(t),i=s.parent;if("list-item"===s.type){const t=i.parent;return 0===e&&Array.isArray(i.blocks)&&i.blocks[0]===s&&"list-item"!==t.type&&Array.isArray(t.blocks)&&t.blocks[0]===i}return 0===e&&Array.isArray(i.blocks)&&i.blocks[0]===s}getBlockLastNode(t){if("list-item"===t.type)return t.children&&t.children.length>0?this.getBlockLastNode(t.children[t.children.length-1]):t.nodes[t.nodes.length-1];if("number-list"===t.type||"bullet-list"===t.type){if(t.blocks)return this.getBlockLastNode(t.blocks[t.blocks.length-1])}else if(t.nodes)return t.nodes[t.nodes.length-1]}getBlockFirstNode(t){if("number-list"===t.type||"bullet-list"===t.type){if(t.blocks)return this.getBlockFirstNode(t.blocks[0])}else if(t.nodes)return t.nodes[0]}getPreviousBlock(t){if(t&&t.parent&&t.parent.blocks){const s=t.parent.blocks.indexOf(t);if(s>0)return t.parent.blocks[s-1];if(("number-list"===t.parent.type||"bullet-list"===t.parent.type)&&0===s)return this.getPreviousBlock(t.parent)}}getNextBlock(t){if(t&&t.parent&&t.parent.blocks){const s=t.parent.blocks.indexOf(t);if(t.parent.blocks[s+1])return t.parent.blocks[s+1];if("list-item"===t.type&&t.parent.blocks.length===s+1)return this.getNextBlock(t.parent)}}replaceNodeWithNodes(t,s){this.nodes&&(s.forEach((t=>{t.parentBlock=this})),this.nodes=this.nodes.flatMap((e=>e===t?s:e)))}}class B extends r{constructor(t="md",s){super(),this.type=h.IMAGE,this.size=t,this.alt=s}static from(t,s){return[h.IMAGE,new B(t,s)]}toJSON(){return b(this.alt)?{size:this.size,alt:this.alt}:{size:this.size}}render(){switch(this.size){case"sm":return{width:"25%"};case"md":return{width:"50%"};case"lg":return{width:"100%"}}}}class C extends o{constructor(t,s,e,i){super(t,i),this.type=a.IMAGE,this.url=s,this.parentBlock=e}static from(t,s){const e=new C(t.id,t.url,s);let i;return i=t.annotations&&0!==Object.keys(t.annotations).length?t.annotations:{size:"md"},e.annotationMap=new Map(Object.keys(i).map((()=>B.from(i.size,i.alt))).filter(b)),e}toJSON(){const t=this.annotationMap.get(h.IMAGE),s={};return(null==t?void 0:t.size)&&(s.size=t.size),(null==t?void 0:t.alt)&&(s.alt=t.alt),Object.assign(Object.assign({id:this.id},Object.keys(s).length>0?{annotations:s}:{}),{type:"image",url:this.url})}doAnnotationActionApply(t){const s=t.toAnnotation();this.annotationMap.set(s.type,s)}doModifyActionApply(t){}}class j extends e{constructor(t){super(),this.type=i.REPLACE_CHILD_NODES,this.newChildNodes=t}}class v extends e{constructor(t,...s){super(),this.type=i.INSERT_BLOCKS_AFTER,this.referBlock=t,this.blocksToBeInserted=s}}class L extends e{constructor(t,s){super(),this.type=i.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=s}}class E{}class I extends E{constructor(){super(...arguments),this.doSplit=!0}}class J extends c{constructor(t){super(),this.type=u.SELECTION_RANGE,this.range=t}}class M extends r{constructor(t){super(),this.type=h.STRIKETHROUGH,this.strikethrough=t}static from(t){return[h.STRIKETHROUGH,new M(t)]}toJSON(){return{strikethrough:this.strikethrough}}renderClass(){return this.strikethrough?"v-rte--strikethrough":null}render(){return null}}class T extends r{constructor(t){super(),this.type=h.UNDERLINE,this.underline=t}static from(t){return[h.UNDERLINE,new T(t)]}toJSON(){return{underline:this.underline}}renderClass(){return this.underline?"v-rte--underline":null}render(){return null}}class F extends r{constructor(t){super(),this.type=h.ITALIC,this.italic=t}static from(t){return[h.ITALIC,new F(t)]}toJSON(){return{italic:this.italic}}render(){return this.italic?{"font-style":"italic"}:null}}class W extends r{constructor(t){super(),this.type=h.BOLD,this.bold=t}static from(t){return[h.BOLD,new W(t)]}toJSON(){return{bold:this.bold}}render(){return this.bold?{"font-weight":"700"}:null}}class z extends c{constructor(){super(...arguments),this.type=u.CLEAR_FORMATTING,this.items=[h.BOLD,h.ITALIC,h.UNDERLINE,h.STRIKETHROUGH,h.TEXT_COLOR,h.CODE]}}class P extends r{constructor(t){super(),this.type=h.CODE,this.code=t}static from(t){return[h.CODE,new P(t)]}toJSON(){return{code:this.code}}renderClass(){return this.code?"v-rte--code":null}render(){return null}}class H extends r{constructor(t){super(),this.type=h.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[h.TEXT_COLOR,new H(t)]}toJSON(){return{textColor:this.textColor.key}}renderClass(){return null}render(){return{color:l.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return O.find((s=>s.key===t))||O[0]}}class D extends r{constructor(t){super(),this.type=h.LINK,this.link=t}static from(t){return[h.LINK,new D({href:t.href,groupKey:t.groupKey})]}toJSON(){return{link:{href:this.link.href,groupKey:this.link.groupKey}}}toEqual(t){return this.link.groupKey===t.link.groupKey}render(){return null}}class V extends I{constructor({link:t,newText:s,needMergeNode:e,doSplit:i}){super(),this.isFlushable=!0,this.link=t,this.needMergeNode=e,this.newText=s,b(i)&&(this.doSplit=i)}toAnnotation(){return new D(this.link)}}class K extends I{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new P(this.code)}}class U extends I{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new z}}class q extends e{constructor(t){super(),this.type=i.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class R extends c{constructor(t){super(),this.type=u.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}}class $ extends E{constructor(t,s){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=s}toAnnotation(){return new R(this.groupKey)}}class Z extends E{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}class G extends E{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}class Q extends o{constructor(t,s,e,i){super(t,i),this.type=a.TEXT,this.parentBlock=e,this.text=s}static from(t,s){const e=new Q(t.id,t.text,s),{annotations:i}=t;return i&&(e.annotationMap=new Map(Object.keys(i).map((t=>(i.link&&s.apply(new $(i.link.groupKey,[e])),this.createAnnotationEntity(t,i[t])))).filter(b))),e}static createAnnotationEntity(t,s){switch(t){case"bold":return W.from(s);case"italic":return F.from(s);case"underline":return T.from(s);case"strikethrough":return M.from(s);case"code":return P.from(s);case"textColor":return H.from(s);case"link":return D.from(s)}}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof r)).reduce(((t,s)=>Object.assign(Object.assign({},t),s.toJSON())),{});return Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"text",text:this.text})}cloneWithText(t){return new Q(k(),t,this.parentBlock,new Map(this.annotationMap))}isEmpty(){return!this.text||""===this.text||"\n"===this.text}doAnnotationActionApply(t){const s=this.getAnnotationByType(u.SELECTION_RANGE);if(t instanceof I&&t.doSplit&&s){const{startContainer:e,endContainer:i,startOffset:n,endOffset:r}=s.range,h=e===i&&n===r;this.parentBlock.nodes=this.parentBlock.nodes.flatMap((e=>e.id===this.id?h?this.insertNewNode(n,t):this.shouldSplitSelection(s.range)?this.splitTextNode(t,s.range):(this.applyActionToNode(this,t),this):e))}else this.applyActionToNode(this,t);this.parentBlock.mergeNodes(t)}doModifyActionApply(t){switch(t.type){case i.UPDATE_TEXT:this.updateText(t.newTextContent);break;case i.REPLACE_SELECTED_TEXT:this.replaceSelectedText(t.textToBeInsert,t.currentRange)}}splitTextNode(t,s){const{startContainer:e,endContainer:i,startOffset:r}=s,h=e.parentElement,o=i.parentElement,a=(t,s,e)=>{const i=t.substring(0,s),n=t.substring(s,e),r=t.substring(e);return[this.cloneWithText(i),this.cloneWithText(n),this.cloneWithText(r)]},c=h&&n.getEntityByDOM(h),u=o&&n.getEntityByDOM(o);if(c&&c.id===this.id){const n=e===i?s.endOffset:this.text.length,[h,o,c]=a(this.text,r,n);return this.applyActionToNode(o,t),[h,o,c].filter((t=>!!t.text))}if(u&&u.id===this.id){const[e,i,n]=a(this.text,0,s.endOffset);return this.applyActionToNode(i,t),[e,i,n].filter((t=>!!t.text))}return this.applyActionToNode(this,t),this}applyActionToNode(t,s){const e=s.toAnnotation();if(s instanceof Z)this.syncUpSelectedNodes(t);else if(e instanceof J||this.syncUpSelectedNodes(t),s instanceof G)this.annotationMap.delete(s.annotationType);else{if(!(e instanceof z))return e instanceof r||e instanceof J?(s instanceof V&&(b(s.newText)&&(t.text=s.newText),this.parentBlock.apply(new $(s.link.groupKey,[t]))),s instanceof K&&this.applyActionToNode(t,new U),void t.annotationMap.set(e.type,e)):void 0;e.items.forEach((s=>{t.deleteAnnotationByType(s)}))}}replaceSelectedText(t,s){if(s&&s.startContainer&&s.endContainer){const{startContainer:e,endContainer:i,startOffset:r,endOffset:h}=s,o=e.parentElement,a=i.parentElement,c=o&&n.getEntityByDOM(o),u=a&&n.getEntityByDOM(a);let l=0,d=this.text.length;c&&c===this?(l=r,d=e===i?h:d):u&&u===this&&(d=h),this.apply(new q(this.text.slice(0,l)+t+this.text.slice(d)))}}updateText(t){this.text=t,!this.text&&this.isLinkNode()&&this.annotationMap.delete(h.LINK)}isLinkNode(){return this.annotationMap.has("LINK")}shouldSplitSelection(t){const{startContainer:s,endContainer:e,startOffset:i,endOffset:n}=t;return s!==e||i>0||n<(e.textContent?e.textContent.length:0)}syncUpSelectedNodes(t){const s=n.getDOMByEntity(this);if(s){const e=p.getSubjectFromParentNodeByEventId(s,w);e&&d.notify(e,{node:t})}}insertNewNode(t,s){if(0===t){const t=this.cloneWithText("");return this.applyActionToNode(t,s),[t,this]}if(t===this.text.length){const t=this.cloneWithText("");return this.applyActionToNode(t,s),[this,t]}const e=this.cloneWithText(this.text.substring(0,t)),i=this.cloneWithText(""),n=this.cloneWithText(this.text.substring(t));return this.applyActionToNode(i,s),[e,i,n]}}class X extends t{constructor(t){super(),this.type=s.TEXT_STYLE,this.textStyle=t}static from(t){return[s.TEXT_STYLE,new X(t)]}toJSON(){return{textStyle:this.textStyle}}render(){const t={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500"};switch(this.textStyle){case"paragraph":return t;case"title":return{fontFamily:"Inter",fontSize:"36px",lineHeight:"40px",fontWeight:"500"};case"subtitle":return{fontFamily:"Inter",fontSize:"28px",lineHeight:"32px",fontWeight:"500"};case"heading-1":return{fontFamily:"Inter",fontSize:"22px",lineHeight:"24px",fontWeight:"500"};case"heading-2":return{fontFamily:"Inter",fontSize:"20px",lineHeight:"24px",fontWeight:"500"};case"heading-3":return{fontFamily:"Inter",fontSize:"18px",lineHeight:"22px",fontWeight:"500"}}}}class Y extends E{constructor(t,s){super(),this.isFlushable=!0,this.textStyle=t,this.bold=s}toAnnotation(){return new X(this.textStyle)}}class _ extends I{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new W(this.bold)}}class tt extends e{constructor(t){super(),this.type=i.MERGE_TWO_BLOCKS_NODES,this.blockNeedToBeMerged=t}}class st extends e{constructor(t,...s){super(),this.type=i.INSERT_BLOCKS_BEFORE,this.referBlock=t,this.blocksToBeInserted=s}}class et extends S{constructor(t,s){super(t),this.nodes=[],this.type=s,this.annotationMap=et.isAcceptableTextStyle(s)?new Map([X.from(s)]):new Map([X.from("paragraph")])}static from(t){const s=new et(t.id,t.type),{annotations:e}=t;return s.nodes=t.nodes.map((t=>Q.from(t,s))),e&&Object.entries(e).forEach((([t,e])=>{const i=this.createAnnotationEntity(t,e);b(i)&&s.annotationMap.set(...i)})),s}static createAnnotationEntity(t,s){return"textStyle"===t?X.from(s):super.createAnnotationEntity(t,s)}static isAcceptableTextStyle(t){return["title","subtitle","paragraph","heading-1","heading-2","heading-3"].includes(t)}mergeNodes(t){this.nodes=this.nodes.reduce(((s,e)=>{const i=s.at(-1);if(t instanceof V&&t.needMergeNode){const t=null==i?void 0:i.getAnnotationByType(h.LINK),n=e.getAnnotationByType(h.LINK);if(t&&n&&t.toEqual(n))return s}return[...s,e]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.nodes.map((t=>t.toJSON()))})}cloneWithNodes(t){const s=new et(k(),this.type);return s.nodes=[],s.apply(new y(t)),s}isNotEmpty(){return this.nodes.length>0&&this.nodes.some((t=>!t.isEmpty()))}getLastNode(){return this.nodes[this.nodes.length-1]}doAnnotationActionApply(t){if(t instanceof Y)return"list-item"!==this.type&&(this.type=t.textStyle),void this.nodes.forEach(t.bold?t=>{const s=new _(!0);s.doSplit=!1,t.apply(s)}:t=>{t.apply(new G(h.BOLD))});if(t instanceof $){const s=this.getAnnotationByType(u.LINK_GROUP);if(s){const e=s.linkGroups.get(t.groupKey);s.linkGroups.set(t.groupKey,[...e,...t.nodes]),this.annotationMap.set(u.LINK_GROUP,s)}}}doModifyActionApply(t){switch(t.type){case i.DELETE_CHILD:this.removeChildNode(t);break;case i.APPEND_CHILD_NODES:this.appendChildNodes(t.entityToBeAppended);break;case i.CLEAR_CHILD_NODES:this.nodes=[];break;case i.SPLIT_BLOCK_WITH_NODE:t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode);break;case i.REPLACE_CHILD_NODES:this.nodes=[],this.appendChildNodes(t.newChildNodes);break;case i.MERGE_TWO_BLOCKS_NODES:this.mergeTwoBlocksNodes(t.blockNeedToBeMerged);break;case i.BREAK_SINGLE_BLOCK:t.newBlock=this.breakSingleTextBlock(t.startContainerNode,t.startOffset);break;case i.LINE_BREAK_SINGLE_BLOCK:t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset);break;case i.LINE_BREAK_MULTIPLE_BLOCKS:t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks);break;case i.TRANSFORM_LIST_BLOCK:this.convertParagraphToList(t);break;case i.DELETE_BLOCK_CONTENT:this.deleteNodeContent(t);break;case i.INSERT_IMAGE_TO_BLOCK:this.insertImage(t);break;case i.INSERT_NODES_BEFORE:this.replaceNodeWithNodes(t.referNode,[...t.nodesToBeInserted,t.referNode])}}splitTextNodeBlock(t,s){if(t){const e=t.text.slice(0,s),i=t.text.slice(s),n=this.nodes.indexOf(t);if(n>-1){const s=this.nodes.slice(0,n),r=this.nodes.slice(n+1);e&&s.push(t.cloneWithText(e)),i&&r.unshift(t.cloneWithText(i)),this.apply(new j(s));const h=this.cloneWithNodes(r);return this.parent.apply(new v(this,h)),h}}}isCaretPositionAtStart(t,s){return t===this.nodes[0]&&0===s}isCaretPositionAtEnd(t,s){const e=this.nodes[this.nodes.length-1];return t===e&&(t.isEmpty()||s===e.text.length)}lineBreakSingleBlock(t,s){if(t){const e=new Q(k(),"\n",this),i=t.text.slice(0,s),n=t.text.slice(s),r=this.nodes.indexOf(t);if(r>-1){const s=this.nodes.slice(0,r),h=this.nodes.slice(r+1);i&&s.push(t.cloneWithText(i)),n&&h.unshift(t.cloneWithText(n)),this.mergeLineBreakNodes(s,e,h)}return e}}lineBreakMultipleBlocks(t){const s=this.nodes,e=new Q(k(),"\n",this),i=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(s,e,i),e}deleteNodeContent(t){const s=t.startContainerNode,e=t.startOffset;if(0!==e&&!s.isEmpty()){const i=s.text.slice(0,e-1)+s.text.slice(e);if(s.apply(new q(i)),i)return void(t.previousNode=s);{const e=this.getPreviousNode(s);return e&&e.parentBlock===this&&"\n"===e.text||1===this.nodes.length?void(t.previousNode=s):(this.apply(new N(s)),void(t.previousNode=e))}}{let e=this.getPreviousNode(s),i=null;if(this.nodes.length&&e&&e.parentBlock!==this)s.isEmpty()&&this.apply(new N(s)),e.parentBlock.apply(new tt(this));else if(this.isContentFirstNode(s)&&s.isEmpty()&&(i=this.getNextNode(s)),s.isEmpty()&&this.apply(new N(s)),e instanceof Q&&e.isEmpty()){const t=e;e=this.getPreviousNode(e),t.parentBlock.apply(new N(t)),e||(i=s)}0===this.nodes.length&&this.parent.apply(new N(this)),e?t.previousNode=e:i&&(t.nextNode=i)}}removeChildNode(t){this.nodes=this.nodes.filter((s=>s!==t.entityToBeRemoved)),0===this.nodes.length&&this.parent.apply(new N(this))}mergeLineBreakNodes(t,s,e){(0===e.length||e[0]&&""===e[0].text)&&e.push(new Q(k(),"\n",this,t[t.length-1]&&t[t.length-1].annotationMap)),this.apply(new j([...t,s,...e]))}breakSingleTextBlock(t,s){const e=this.copyInlineStyleToNewParagraph(t);if(this.isCaretPositionAtEnd(t,s))this.parent.apply(new v(this,e));else{if(!this.isCaretPositionAtStart(t,s)){const e=new L(t,s);return this.apply(e),e.newBlock}this.parent.apply(new st(this,e))}return e}convertParagraphToList(t){const s=this.parent.createList(t.listType),e=t.selectedBlocks.map((t=>this.parent.toListItem(t)));s.apply(new y(e)),this.parent.apply(new v(t.selectedBlocks[0],s)),t.selectedBlocks.forEach((t=>{t.parent.apply(new N(t))}))}insertImage(t){const s=t.splitPointNode,e=t.startOffsetOfNode,i=t.imageBlockToBeInserted;if(this.isCaretPositionAtEnd(s,e))this.parent.apply(new v(this,i));else if(this.isCaretPositionAtStart(s,e))this.parent.apply(new st(this,i));else{const t=new L(s,e);this.apply(t),this.parent.apply(new v(this,i))}}copyInlineStyleToNewParagraph(t){const s=t.cloneWithText("");s.annotationMap.delete(h.LINK);const e=new et(k(),"paragraph");return e.apply(new y([s])),e}}class it extends S{constructor(t){super(t),this.type="image",this.nodes=[]}static from(t){const s=new it(t.id),{annotations:e}=t;return s.nodes=t.nodes.map((t=>C.from(t,s))),e&&Object.entries(e).forEach((([t,e])=>{const i=this.createAnnotationEntity(t,e);b(i)&&s.annotationMap.set(...i)})),s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:"image",nodes:this.nodes.map((t=>t.toJSON()))})}isNotEmpty(){return this.nodes.length>0&&this.nodes.some((t=>t.url.length>0))}getLastNode(){return this.nodes[this.nodes.length-1]}doModifyActionApply(t){switch(t.type){case i.DELETE_CHILD:this.removeChildNode(t);break;case i.CLEAR_CHILD_NODES:this.nodes=[];break;case i.APPEND_CHILD_NODES:this.appendChildNodes(t.entityToBeAppended);break;case i.REPLACE_CHILD_NODES:this.nodes=[],this.appendChildNodes(t.newChildNodes);break;case i.SPLIT_BLOCK_WITH_NODE:t.newBlock=this.splitImageNodes(t.splitPointNode,t.startOffsetOfNode);break;case i.MERGE_TWO_BLOCKS_NODES:this.mergeTwoBlocksNodes(t.blockNeedToBeMerged);break;case i.BREAK_SINGLE_BLOCK:t.newBlock=this.breakSingleBlock(t.startContainerNode,t.startOffset);break;case i.LINE_BREAK_SINGLE_BLOCK:t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset);break;case i.LINE_BREAK_MULTIPLE_BLOCKS:t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks);break;case i.DELETE_BLOCK_CONTENT:this.deleteNodeContent(t);break;case i.INSERT_IMAGE_TO_BLOCK:this.insertImage(t);break;case i.INSERT_NODES_AFTER:this.replaceNodeWithNodes(t.referNode,[t.referNode,...t.nodesToBeInserted]);break;case i.INSERT_NODES_BEFORE:this.replaceNodeWithNodes(t.referNode,[...t.nodesToBeInserted,t.referNode])}}removeChildNode(t){this.nodes=this.nodes.filter((s=>s!==t.entityToBeRemoved)),0===this.nodes.length&&this.parent.apply(new N(this))}splitImageNodes(t,s){const e=this.nodes.indexOf(t);if(e>-1){const t=this.nodes.slice(0,e+s),i=this.nodes.slice(e+s);this.apply(new j(t));const n=this.cloneWithNodes(i);return this.parent.apply(new v(this,n)),n}}cloneWithNodes(t){const s=new it(k());return s.nodes=[],s.apply(new y(t)),s}breakSingleBlock(t,s){const e=et.from({id:k(),type:"paragraph",nodes:[{id:k(),type:"text",text:""}]});if(this.isCaretPositionAtEnd(t,s))this.parent.apply(new v(this,e));else{if(!this.isCaretPositionAtStart(t,s)){const e=new L(t,s);return this.apply(e),e.newBlock}this.parent.apply(new st(this,e))}return e}lineBreakSingleBlock(t,s){const e=this.breakSingleBlock(t,s);if(e)return e.nodes[0]}isCaretPositionAtStart(t,s){return t===this.nodes[0]&&0===s}isCaretPositionAtEnd(t,s){return t===this.nodes[this.nodes.length-1]&&1===s}lineBreakMultipleBlocks(t){const s=et.from({id:k(),type:"paragraph",nodes:[{id:k(),type:"text",text:"\n"}]});this.parent.apply(new v(this,s));const e=this.concatBlocksNodes(t.slice(1));return(0===e.length||e[0]&&""===e[0].text)&&e.push(new Q(k(),"\n",s)),s.apply(new y(e)),s.nodes[0]}deleteNodeContent(t){const s=t.startContainerNode,e=t.startOffset;let i=this.getPreviousNode(s),n=null;if(1===e){const t=s.parentBlock;this.isContentFirstNode(s)&&(n=this.getNextNode(s)),1===t.nodes.length?t.parent.apply(new N(t)):s.parentBlock.apply(new N(s))}else{const e=i;e&&e instanceof C&&(i=this.getPreviousNode(e),e.parentBlock.apply(new N(e)),i||(t.nextNode=s))}i?t.previousNode=i:n&&(t.nextNode=n)}insertImage(t){const s=t.splitPointNode,e=t.startOffsetOfNode,i=t.imageBlockToBeInserted;this.nodes.length<1?this.apply(new y(t.imageBlockToBeInserted.nodes)):this.isCaretPositionAtEnd(s,e)?this.parent.apply(new v(this,i)):this.isCaretPositionAtStart(s,e)?this.parent.apply(new st(this,i)):(this.apply(new L(s,e)),this.parent.apply(new v(this,i)))}}class nt extends et{constructor(t,s){super(t,"list-item"),this.children=[],this.children=s}static from(t){const s=new nt(t.id);s.nodes=t.nodes.map((t=>Q.from(t,s))),t.children&&(s.children=t.children.map((t=>{const e=ht.from(t);return e.parent=s,e})));const{annotations:e}=t;return e&&Object.entries(e).forEach((([t,e])=>{const i=this.createAnnotationEntity(t,e);b(i)&&s.annotationMap.set(...i)})),s}toJSON(){var t;return Object.assign(Object.assign({},super.toJSON()),{type:"list-item",children:null===(t=this.children)||void 0===t?void 0:t.map((t=>t.toJSON()))})}cloneWithNodes(t){const s=new nt(k());return s.nodes=[],s.apply(new y(t)),s}isNotEmpty(){return this.children?super.isNotEmpty()||this.children.some((t=>t.isNotEmpty())):super.isNotEmpty()}getLastNode(){return this.children&&this.children.length>0?this.children[this.children.length-1].getLastNode():super.getLastNode()}doModifyActionApply(t){switch(t.type){case i.DELETE_CHILD:this.removeListChildNode(t);break;case i.DELETE_NEST_LIST:this.removeNestList(t);break;case i.APPEND_CHILD_NODES:this.appendChildNodes(t.entityToBeAppended);break;case i.CLEAR_CHILD_NODES:this.nodes=[];break;case i.SPLIT_BLOCK_WITH_NODE:this.splitListItemBlock(t);break;case i.REPLACE_CHILD_NODES:this.nodes=[],this.appendChildNodes(t.newChildNodes);break;case i.REPLACE_NEST_LIST:this.replaceNestList(t.newList);break;case i.MERGE_TWO_BLOCKS_NODES:this.mergeTwoBlocksNodes(t.blockNeedToBeMerged);break;case i.BREAK_SINGLE_BLOCK:t.newBlock=this.breakSingleListItemBlock(t.startContainerNode,t.startOffset);break;case i.LINE_BREAK_SINGLE_BLOCK:t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset);break;case i.LINE_BREAK_MULTIPLE_BLOCKS:t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks);break;case i.DELETE_BLOCK_CONTENT:this.deleteListNodeContent(t);break;case i.INSERT_IMAGE_TO_BLOCK:this.parent.apply(t);break;case i.INSERT_NODES_BEFORE:this.replaceNodeWithNodes(t.referNode,[...t.nodesToBeInserted,t.referNode])}}removeListChildNode(t){this.nodes=this.nodes.filter((s=>s!==t.entityToBeRemoved)),0!==this.nodes.length||this.children&&this.children.length||this.parent.apply(new N(this))}removeNestList(t){this.children&&(this.children=this.children.length>1?this.children.filter((s=>s!==t.nestListBlockToBeRemoved)):void 0)}replaceNestList(t){t.forEach((t=>{t.parent=this})),this.children=t}splitListItemBlock(t){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode)}breakSingleListItemBlock(t,s){const e=new nt(k()),i=this.copyInlineStyleToNewNode(t);if(e.apply(new y([i])),this.isCaretPositionAtEnd(t,s))return this.breakListItemAtEnd(e);if(!this.isCaretPositionAtStart(t,s)){const e=new L(t,s);return this.apply(e),e.newBlock}return this.parent.apply(new st(this,e)),e}breakListItemAtEnd(t){const s=this.parent.blocks[this.parent.blocks.length-1],e=1===this.nodes.length&&this.nodes[0].isEmpty();if(this===s&&e){const s=this.parent.parent;if("list-item"!==s.type){const e=et.from({id:k(),type:"paragraph",nodes:[]});return e.apply(new y(t.nodes)),s.apply(new v(this.parent,e)),this.parent.apply(new N(this)),e}s.parent.apply(new v(s,t)),this.parent.apply(new N(this))}else this.parent.apply(new v(this,t));return t}deleteListNodeContent(t){const s=t.startContainerNode.parentBlock.parent;this.deleteNodeContent(t),0===s.blocks.length&&s.parent.apply(new N(s))}copyInlineStyleToNewNode(t){const s=t.cloneWithText("");return s.annotationMap.delete(h.LINK),s}}class rt extends e{constructor(t){super(),this.type=i.DELETE_NEST_LIST,this.nestListBlockToBeRemoved=t}}class ht extends S{constructor(t,s){super(t),this.type="bullet-list",this.blocks=[],this.type=s}static from(t){const s=new ht(t.id,t.type);return s.blocks=t.blocks.map((t=>{const e=nt.from(t);return e.parent=s,e})),s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,blocks:this.blocks.map((t=>t.toJSON()))})}isNotEmpty(){return this.blocks.length>0&&this.blocks.some((t=>t.isNotEmpty()))}getLastNode(){return this.blocks[this.blocks.length-1].getLastNode()}doModifyActionApply(t){switch(t.type){case i.DELETE_CHILD:this.removeListItemBlock(t.entityToBeRemoved);break;case i.INSERT_BLOCKS_AFTER:this.replaceBlockWithBlocks(t.referBlock,[t.referBlock,...t.blocksToBeInserted]);break;case i.INSERT_BLOCKS_BEFORE:this.replaceBlockWithBlocks(t.referBlock,[...t.blocksToBeInserted,t.referBlock]);break;case i.APPEND_CHILD_NODES:this.appendChildBlocks(t.entityToBeAppended);break;case i.TRANSFORM_LIST_BLOCK:this.convertToList(t);break;case i.TRANSFORM_PARAGRAPH_BLOCK:this.convertToParagraph(t);break;case i.INSERT_IMAGE_TO_BLOCK:this.insertImage(t)}}toParagraph(t){const s=new et(k(),"paragraph");return s.apply(new y(t.nodes)),s.annotationMap=t.annotationMap,s}convertToList(t){const s=t.selectedBlocks,e=this.parent.createList(t.listType);if(s.every((t=>t.parent===this)))e.apply(new y(this.blocks)),this.parent.apply(new v(this,e)),this.parent.apply(new N(this)),s.forEach((t=>t.nodes.map((t=>t.apply(new Z)))));else{const s=t.selectedBlocks.map((t=>this.parent.toListItem(t)));e.apply(new y(s)),this.parent.apply(new v(this,e)),t.selectedBlocks.forEach((t=>{t.parent.apply(new N(t))})),0===this.blocks.length&&this.parent.apply(new N(this))}}convertToParagraph(t){let s=!1,e=!1;const i=t.selectedBlocks,n=i.map((t=>(t.nodes.map((t=>t.apply(new Z))),t===this.blocks[0]&&(s=!0),t===this.blocks[this.blocks.length-1]&&(e=!0),this.toParagraph(t))));if(s)this.parent.apply(new st(this,...n));else if(e)this.parent.apply(new v(this,...n));else{const t=this.blocks.indexOf(i[0]),s=this.blocks.indexOf(i[i.length-1]),e=this.parent.createList(this.type);e.apply(new y(this.blocks.slice(0,t)));const r=this.parent.createList(this.type);r.apply(new y(this.blocks.slice(s+1))),this.parent.apply(new st(this,e,...n,r)),this.parent.apply(new N(this))}i.map((t=>{this.apply(new N(t))})),0===this.blocks.length&&this.parent.apply(new N(this))}insertImage(t){this.parent.apply("list-item"!==this.parent.type?new v(this,t.imageBlockToBeInserted):t)}removeListItemBlock(t){super.removeChildBlock(t),0===this.blocks.length&&this.parent&&this.parent.apply(this.parent instanceof nt?new rt(this):new N(this))}}class ot extends x{constructor(t){super(),t.forEach((t=>{t.parent=this})),this.blocks=t}static fromJSON(t){const s=t.map((t=>{switch(t.type){case"paragraph":case"title":case"subtitle":case"heading-1":case"heading-2":case"heading-3":return et.from(t);case"image":return it.from(t);case"bullet-list":case"number-list":return ht.from(t);default:throw new Error(`[Vega] Unknown block type: ${t.type}`)}}));return new ot(s)}static createEmptyContent(){return ot.fromJSON([{id:k(),type:"paragraph",nodes:[{id:k(),type:"text",text:""}]}])}clone(){return new ot([...this.blocks])}toJSON(){return this.blocks.map((t=>t.toJSON()))}apply(t){switch(t.type){case i.DELETE_CHILD:this.removeChildBlock(t.entityToBeRemoved);break;case i.APPEND_CHILD_NODES:this.appendChildBlocks(t.entityToBeAppended);break;case i.INSERT_BLOCKS_AFTER:this.replaceBlockWithBlocks(t.referBlock,[t.referBlock,...t.blocksToBeInserted]);break;case i.INSERT_BLOCKS_BEFORE:this.replaceBlockWithBlocks(t.referBlock,[...t.blocksToBeInserted,t.referBlock])}}toListItem(t){t.nodes.map((t=>t.apply(new Z)));const s=new nt(k());return s.apply(new y(t.nodes)),s.annotationMap=t.annotationMap,s}createList(t){return new ht(k(),t)}}export{E as A,_ as B,U as C,m as H,B as I,V as L,tt as M,et as R,M as S,I as T,T as U,ot as V,A as Z,it as a,nt as b,ht as c,S as d,C as e,Q as f,H as g,O as h,F as i,Y as j,X as k,W as l,K as m,J as n,g as o,q as p,N as q,y as r,st as s,L as t,j as u,v}
|
|
1
|
+
import{B as t,a as s,M as e,b as i,s as n,N as r,c as h,R as o,d as a,A as c,I as u,V as l}from"./p-0461e318.js";import{C as d}from"./p-2d0d575f.js";import{d as p}from"./p-7c37e5bb.js";import{V as f,b as w}from"./p-348e95ba.js";import{i as b}from"./p-b1f65b13.js";import"./p-6e1ab235.js";import{g as k}from"./p-33b62194.js";class m extends t{constructor(t){super(),this.type=s.ALIGNMENT,this.textAlign=t}static from(t){return[s.ALIGNMENT,new m(t)]}toJSON(){return{textAlign:this.textAlign}}renderClass(){return`v-rte--horizontal-alignment-${this.textAlign}`}render(){return null}}class g extends t{constructor(t){super(),this.type=s.INDENT,this.indent=Math.max(0,t)}static from(t){return[s.INDENT,new g(t)]}toJSON(){return this.indent>0?{indent:this.indent}:null}render(){return this.indent>0?{"margin-left":16*this.indent+"px"}:null}}class x{replaceBlockWithBlocks(t,s){this.blocks&&(s.forEach((t=>{t.parent=this})),this.blocks=this.blocks.flatMap((e=>e===t?s:e)))}appendChildBlocks(t){this.blocks&&(t.forEach((t=>{t.parent=this})),this.blocks=this.blocks.concat(t))}removeChildBlock(t){this.blocks&&(this.blocks=this.blocks.filter((s=>s!==t)))}}class y extends e{constructor(t){super(),this.type=i.APPEND_CHILD_NODES,this.entityToBeAppended=t}}class N extends e{constructor(t){super(),this.type=i.DELETE_CHILD,this.entityToBeRemoved=t}}const O=[{key:"black",light:"#111128",dark:"#E3E3E8"},{key:"gray",light:"#5E5E6D",dark:"#B9B9C1"},{key:"green",light:"#01801F",dark:"#59D977"},{key:"red",light:"#BD2947",dark:"#FFB2B5"},{key:"purple",light:"#563D82",dark:"#BEB2FF"},{key:"teal",light:"#17758F",dark:"#4CD8FF"}],A="";class S extends x{constructor(t){super(),this.annotationMap=new Map,this.id=t}static createAnnotationEntity(t,s){switch(t){case"textAlign":return m.from(s);case"indent":return g.from(s)}}toJSON(){const s=Array.from(this.annotationMap.values()).filter((s=>s instanceof t)).reduce(((t,s)=>Object.assign(Object.assign({},t),s.toJSON())),{});return Object.assign({id:this.id},Object.keys(s).length>0?{annotations:s}:{})}getAnnotationByType(t){return this.annotationMap.get(t)}apply(t){if(this.doApply(t),t.isFlushable){const t=n.getDOMByEntity(this);if(t){const s=p.getSubjectFromParentNodeByEventId(t,f);s&&d.notify(s,{})}}}doApply(t){t instanceof e?this.doModifyActionApply(t):this.applyAnnotationAction(t)}applyAnnotationAction(t){const s=t.toAnnotation();this.annotationMap.set(s.type,s),"function"==typeof this.doAnnotationActionApply&&this.doAnnotationActionApply(t)}appendChildNodes(t){t.forEach((t=>{t.parentBlock=this})),this.nodes=this.nodes.concat(t)}mergeTwoBlocksNodes(t){if(this.type===t.type||"image"!==this.type&&"image"!==t.type){let s=t.nodes;"image"!==this.type&&(s=t.nodes.filter((t=>t.text&&""!==t.text))),this.apply(new y(s)),t.parent.apply(new N(t))}}concatBlocksNodes(t){const s=[];return t.map((t=>{"image"!==t.type&&(s.push(...t.nodes),t.parent.apply(new N(t)))})),s}getPreviousNode(t){const s=t.parentBlock,e=s.nodes.indexOf(t);if(e>0)return s.nodes[e-1];if(s.parent){const t=this.getPreviousBlock(s);if(t)return this.getBlockLastNode(t)}}getNextNode(t){const s=t.parentBlock,e=s.nodes.indexOf(t);if(s.nodes[e+1])return s.nodes[e+1];if(s.parent){const t=this.getNextBlock(s);if(t)return this.getBlockFirstNode(t)}}isContentFirstNode(t){const s=t.parentBlock,e=s.nodes.indexOf(t),i=s.parent;if("list-item"===s.type){const t=i.parent;return 0===e&&Array.isArray(i.blocks)&&i.blocks[0]===s&&"list-item"!==t.type&&Array.isArray(t.blocks)&&t.blocks[0]===i}return 0===e&&Array.isArray(i.blocks)&&i.blocks[0]===s}getBlockLastNode(t){if("list-item"===t.type)return t.children&&t.children.length>0?this.getBlockLastNode(t.children[t.children.length-1]):t.nodes[t.nodes.length-1];if("number-list"===t.type||"bullet-list"===t.type){if(t.blocks)return this.getBlockLastNode(t.blocks[t.blocks.length-1])}else if(t.nodes)return t.nodes[t.nodes.length-1]}getBlockFirstNode(t){if("number-list"===t.type||"bullet-list"===t.type){if(t.blocks)return this.getBlockFirstNode(t.blocks[0])}else if(t.nodes)return t.nodes[0]}getPreviousBlock(t){if(t&&t.parent&&t.parent.blocks){const s=t.parent.blocks.indexOf(t);if(s>0)return t.parent.blocks[s-1];if(("number-list"===t.parent.type||"bullet-list"===t.parent.type)&&0===s)return this.getPreviousBlock(t.parent)}}getNextBlock(t){if(t&&t.parent&&t.parent.blocks){const s=t.parent.blocks.indexOf(t);if(t.parent.blocks[s+1])return t.parent.blocks[s+1];if("list-item"===t.type&&t.parent.blocks.length===s+1)return this.getNextBlock(t.parent)}}replaceNodeWithNodes(t,s){this.nodes&&(s.forEach((t=>{t.parentBlock=this})),this.nodes=this.nodes.flatMap((e=>e===t?s:e)))}}class B extends r{constructor(t="md",s){super(),this.type=h.IMAGE,this.size=t,this.alt=s}static from(t,s){return[h.IMAGE,new B(t,s)]}toJSON(){return b(this.alt)?{size:this.size,alt:this.alt}:{size:this.size}}render(){switch(this.size){case"sm":return{width:"25%"};case"md":return{width:"50%"};case"lg":return{width:"100%"}}}}class C extends o{constructor(t,s,e,i){super(t,i),this.type=a.IMAGE,this.url=s,this.parentBlock=e}static from(t,s){const e=new C(t.id,t.url,s);let i;return i=t.annotations&&0!==Object.keys(t.annotations).length?t.annotations:{size:"md"},e.annotationMap=new Map(Object.keys(i).map((()=>B.from(i.size,i.alt))).filter(b)),e}toJSON(){const t=this.annotationMap.get(h.IMAGE),s={};return(null==t?void 0:t.size)&&(s.size=t.size),(null==t?void 0:t.alt)&&(s.alt=t.alt),Object.assign(Object.assign({id:this.id},Object.keys(s).length>0?{annotations:s}:{}),{type:"image",url:this.url})}doAnnotationActionApply(t){const s=t.toAnnotation();this.annotationMap.set(s.type,s)}doModifyActionApply(t){}}class j extends e{constructor(t){super(),this.type=i.REPLACE_CHILD_NODES,this.newChildNodes=t}}class v extends e{constructor(t,...s){super(),this.type=i.INSERT_BLOCKS_AFTER,this.referBlock=t,this.blocksToBeInserted=s}}class L extends e{constructor(t,s){super(),this.type=i.SPLIT_BLOCK_WITH_NODE,this.splitPointNode=t,this.startOffsetOfNode=s}}class E{}class I extends E{constructor(){super(...arguments),this.doSplit=!0}}class J extends c{constructor(t){super(),this.type=u.SELECTION_RANGE,this.range=t}}class M extends r{constructor(t){super(),this.type=h.STRIKETHROUGH,this.strikethrough=t}static from(t){return[h.STRIKETHROUGH,new M(t)]}toJSON(){return{strikethrough:this.strikethrough}}renderClass(){return this.strikethrough?"v-rte--strikethrough":null}render(){return null}}class T extends r{constructor(t){super(),this.type=h.UNDERLINE,this.underline=t}static from(t){return[h.UNDERLINE,new T(t)]}toJSON(){return{underline:this.underline}}renderClass(){return this.underline?"v-rte--underline":null}render(){return null}}class F extends r{constructor(t){super(),this.type=h.ITALIC,this.italic=t}static from(t){return[h.ITALIC,new F(t)]}toJSON(){return{italic:this.italic}}render(){return this.italic?{"font-style":"italic"}:null}}class W extends r{constructor(t){super(),this.type=h.BOLD,this.bold=t}static from(t){return[h.BOLD,new W(t)]}toJSON(){return{bold:this.bold}}render(){return this.bold?{"font-weight":"700"}:null}}class z extends c{constructor(){super(...arguments),this.type=u.CLEAR_FORMATTING,this.items=[h.BOLD,h.ITALIC,h.UNDERLINE,h.STRIKETHROUGH,h.TEXT_COLOR,h.CODE]}}class P extends r{constructor(t){super(),this.type=h.CODE,this.code=t}static from(t){return[h.CODE,new P(t)]}toJSON(){return{code:this.code}}renderClass(){return this.code?"v-rte--code":null}render(){return null}}class H extends r{constructor(t){super(),this.type=h.TEXT_COLOR,this.textColor=this.formatTextColor(t)}static from(t){return[h.TEXT_COLOR,new H(t)]}toJSON(){return{textColor:this.textColor.key}}renderClass(){return null}render(){return{color:l.isDarkMode()?this.textColor.dark:this.textColor.light}}formatTextColor(t){return O.find((s=>s.key===t))||O[0]}}class D extends r{constructor(t){super(),this.type=h.LINK,this.link=t}static from(t){return[h.LINK,new D({href:t.href,groupKey:t.groupKey})]}toJSON(){return{link:{href:this.link.href,groupKey:this.link.groupKey}}}toEqual(t){return this.link.groupKey===t.link.groupKey}render(){return null}}class V extends I{constructor({link:t,newText:s,needMergeNode:e,doSplit:i}){super(),this.isFlushable=!0,this.link=t,this.needMergeNode=e,this.newText=s,b(i)&&(this.doSplit=i)}toAnnotation(){return new D(this.link)}}class K extends I{constructor(t){super(),this.isFlushable=!0,this.code=t}toAnnotation(){return new P(this.code)}}class U extends I{constructor(){super(...arguments),this.isFlushable=!0}toAnnotation(){return new z}}class q extends e{constructor(t){super(),this.type=i.UPDATE_TEXT,this.newTextContent="",this.newTextContent=t}}class R extends c{constructor(t){super(),this.type=u.LINK_GROUP,this.linkGroups=new Map,this.linkGroups=new Map([[t,[]]])}}class $ extends E{constructor(t,s){super(),this.isFlushable=!1,this.groupKey=t,this.nodes=s}toAnnotation(){return new R(this.groupKey)}}class Z extends E{constructor(){super(),this.isFlushable=!1}toAnnotation(){return null}}class G extends E{constructor(t){super(),this.isFlushable=!0,this.annotationType=t}toAnnotation(){}}class Q extends o{constructor(t,s,e,i){super(t,i),this.type=a.TEXT,this.parentBlock=e,this.text=s}static from(t,s){const e=new Q(t.id,t.text,s),{annotations:i}=t;return i&&(e.annotationMap=new Map(Object.keys(i).map((t=>(i.link&&s.apply(new $(i.link.groupKey,[e])),this.createAnnotationEntity(t,i[t])))).filter(b))),e}static createAnnotationEntity(t,s){switch(t){case"bold":return W.from(s);case"italic":return F.from(s);case"underline":return T.from(s);case"strikethrough":return M.from(s);case"code":return P.from(s);case"textColor":return H.from(s);case"link":return D.from(s)}}toJSON(){const t=Array.from(this.annotationMap.values()).filter((t=>t instanceof r)).reduce(((t,s)=>Object.assign(Object.assign({},t),s.toJSON())),{});return Object.assign(Object.assign({id:this.id},Object.keys(t).length>0?{annotations:t}:{}),{type:"text",text:this.text})}cloneWithText(t){return new Q(k(),t,this.parentBlock,new Map(this.annotationMap))}isEmpty(){return!this.text||""===this.text||"\n"===this.text}doAnnotationActionApply(t){const s=this.getAnnotationByType(u.SELECTION_RANGE);if(t instanceof I&&t.doSplit&&s){const{startContainer:e,endContainer:i,startOffset:n,endOffset:r}=s.range,h=e===i&&n===r;this.parentBlock.nodes=this.parentBlock.nodes.flatMap((e=>e.id===this.id?h?this.insertNewNode(n,t):this.shouldSplitSelection(s.range)?this.splitTextNode(t,s.range):(this.applyActionToNode(this,t),this):e))}else this.applyActionToNode(this,t);this.parentBlock.mergeNodes(t)}doModifyActionApply(t){switch(t.type){case i.UPDATE_TEXT:this.updateText(t.newTextContent);break;case i.REPLACE_SELECTED_TEXT:this.replaceSelectedText(t.textToBeInsert,t.currentRange)}}splitTextNode(t,s){const{startContainer:e,endContainer:i,startOffset:r}=s,h=e.parentElement,o=i.parentElement,a=(t,s,e)=>{const i=t.substring(0,s),n=t.substring(s,e),r=t.substring(e);return[this.cloneWithText(i),this.cloneWithText(n),this.cloneWithText(r)]},c=h&&n.getEntityByDOM(h),u=o&&n.getEntityByDOM(o);if(c&&c.id===this.id){const n=e===i?s.endOffset:this.text.length,[h,o,c]=a(this.text,r,n);return this.applyActionToNode(o,t),[h,o,c].filter((t=>!!t.text))}if(u&&u.id===this.id){const[e,i,n]=a(this.text,0,s.endOffset);return this.applyActionToNode(i,t),[e,i,n].filter((t=>!!t.text))}return this.applyActionToNode(this,t),this}applyActionToNode(t,s){const e=s.toAnnotation();if(s instanceof Z)this.syncUpSelectedNodes(t);else if(e instanceof J||this.syncUpSelectedNodes(t),s instanceof G)this.annotationMap.delete(s.annotationType);else{if(!(e instanceof z))return e instanceof r||e instanceof J?(s instanceof V&&(b(s.newText)&&(t.text=s.newText),this.parentBlock.apply(new $(s.link.groupKey,[t]))),s instanceof K&&this.applyActionToNode(t,new U),void t.annotationMap.set(e.type,e)):void 0;e.items.forEach((s=>{t.deleteAnnotationByType(s)}))}}replaceSelectedText(t,s){if(s&&s.startContainer&&s.endContainer){const{startContainer:e,endContainer:i,startOffset:r,endOffset:h}=s,o=e.parentElement,a=i.parentElement,c=o&&n.getEntityByDOM(o),u=a&&n.getEntityByDOM(a);let l=0,d=this.text.length;c&&c===this?(l=r,d=e===i?h:d):u&&u===this&&(d=h),this.apply(new q(this.text.slice(0,l)+t+this.text.slice(d)))}}updateText(t){this.text=t,!this.text&&this.isLinkNode()&&this.annotationMap.delete(h.LINK)}isLinkNode(){return this.annotationMap.has("LINK")}shouldSplitSelection(t){const{startContainer:s,endContainer:e,startOffset:i,endOffset:n}=t;return s!==e||i>0||n<(e.textContent?e.textContent.length:0)}syncUpSelectedNodes(t){const s=n.getDOMByEntity(this);if(s){const e=p.getSubjectFromParentNodeByEventId(s,w);e&&d.notify(e,{node:t})}}insertNewNode(t,s){if(0===t){const t=this.cloneWithText("");return this.applyActionToNode(t,s),[t,this]}if(t===this.text.length){const t=this.cloneWithText("");return this.applyActionToNode(t,s),[this,t]}const e=this.cloneWithText(this.text.substring(0,t)),i=this.cloneWithText(""),n=this.cloneWithText(this.text.substring(t));return this.applyActionToNode(i,s),[e,i,n]}}class X extends t{constructor(t){super(),this.type=s.TEXT_STYLE,this.textStyle=t}static from(t){return[s.TEXT_STYLE,new X(t)]}toJSON(){return{textStyle:this.textStyle}}render(){const t={fontFamily:"Inter",fontSize:"16px",lineHeight:"22px",fontWeight:"500"};switch(this.textStyle){case"paragraph":return t;case"title":return{fontFamily:"Inter",fontSize:"36px",lineHeight:"40px",fontWeight:"500"};case"subtitle":return{fontFamily:"Inter",fontSize:"28px",lineHeight:"32px",fontWeight:"500"};case"heading-1":return{fontFamily:"Inter",fontSize:"22px",lineHeight:"24px",fontWeight:"500"};case"heading-2":return{fontFamily:"Inter",fontSize:"20px",lineHeight:"24px",fontWeight:"500"};case"heading-3":return{fontFamily:"Inter",fontSize:"18px",lineHeight:"22px",fontWeight:"500"}}}}class Y extends E{constructor(t,s){super(),this.isFlushable=!0,this.textStyle=t,this.bold=s}toAnnotation(){return new X(this.textStyle)}}class _ extends I{constructor(t){super(),this.isFlushable=!0,this.bold=t}toAnnotation(){return new W(this.bold)}}class tt extends e{constructor(t){super(),this.type=i.MERGE_TWO_BLOCKS_NODES,this.blockNeedToBeMerged=t}}class st extends e{constructor(t,...s){super(),this.type=i.INSERT_BLOCKS_BEFORE,this.referBlock=t,this.blocksToBeInserted=s}}class et extends S{constructor(t,s){super(t),this.nodes=[],this.type=s,this.annotationMap=et.isAcceptableTextStyle(s)?new Map([X.from(s)]):new Map([X.from("paragraph")])}static from(t){const s=new et(t.id,t.type),{annotations:e}=t;return s.nodes=t.nodes.map((t=>Q.from(t,s))),e&&Object.entries(e).forEach((([t,e])=>{const i=this.createAnnotationEntity(t,e);b(i)&&s.annotationMap.set(...i)})),s}static createAnnotationEntity(t,s){return"textStyle"===t?X.from(s):super.createAnnotationEntity(t,s)}static isAcceptableTextStyle(t){return["title","subtitle","paragraph","heading-1","heading-2","heading-3"].includes(t)}mergeNodes(t){this.nodes=this.nodes.reduce(((s,e)=>{const i=s.at(-1);if(t instanceof V&&t.needMergeNode){const t=null==i?void 0:i.getAnnotationByType(h.LINK),n=e.getAnnotationByType(h.LINK);if(t&&n&&t.toEqual(n))return s}return[...s,e]}),[])}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:this.type,nodes:this.nodes.map((t=>t.toJSON()))})}cloneWithNodes(t){const s=new et(k(),this.type);return s.nodes=[],s.apply(new y(t)),s}isNotEmpty(){return this.nodes.length>0&&this.nodes.some((t=>!t.isEmpty()))}getLastNode(){return this.nodes[this.nodes.length-1]}doAnnotationActionApply(t){if(t instanceof Y)return"list-item"!==this.type&&(this.type=t.textStyle),void this.nodes.forEach(t.bold?t=>{const s=new _(!0);s.doSplit=!1,t.apply(s)}:t=>{t.apply(new G(h.BOLD))});if(t instanceof $){const s=this.getAnnotationByType(u.LINK_GROUP);if(s){const e=s.linkGroups.get(t.groupKey);s.linkGroups.set(t.groupKey,[...e,...t.nodes]),this.annotationMap.set(u.LINK_GROUP,s)}}}doModifyActionApply(t){switch(t.type){case i.DELETE_CHILD:this.removeChildNode(t);break;case i.APPEND_CHILD_NODES:this.appendChildNodes(t.entityToBeAppended);break;case i.CLEAR_CHILD_NODES:this.nodes=[];break;case i.SPLIT_BLOCK_WITH_NODE:t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode);break;case i.REPLACE_CHILD_NODES:this.nodes=[],this.appendChildNodes(t.newChildNodes);break;case i.MERGE_TWO_BLOCKS_NODES:this.mergeTwoBlocksNodes(t.blockNeedToBeMerged);break;case i.BREAK_SINGLE_BLOCK:t.newBlock=this.breakSingleTextBlock(t.startContainerNode,t.startOffset);break;case i.LINE_BREAK_SINGLE_BLOCK:t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset);break;case i.LINE_BREAK_MULTIPLE_BLOCKS:t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks);break;case i.TRANSFORM_LIST_BLOCK:this.convertParagraphToList(t);break;case i.DELETE_BLOCK_CONTENT:this.deleteNodeContent(t);break;case i.INSERT_IMAGE_TO_BLOCK:this.insertImage(t);break;case i.INSERT_NODES_BEFORE:this.replaceNodeWithNodes(t.referNode,[...t.nodesToBeInserted,t.referNode])}}splitTextNodeBlock(t,s){if(t){const e=t.text.slice(0,s),i=t.text.slice(s),n=this.nodes.indexOf(t);if(n>-1){const s=this.nodes.slice(0,n),r=this.nodes.slice(n+1);e&&s.push(t.cloneWithText(e)),i&&r.unshift(t.cloneWithText(i)),this.apply(new j(s));const h=this.cloneWithNodes(r);return this.parent.apply(new v(this,h)),h}}}isCaretPositionAtStart(t,s){return t===this.nodes[0]&&0===s}isCaretPositionAtEnd(t,s){const e=this.nodes[this.nodes.length-1];return t===e&&(t.isEmpty()||s===e.text.length)}lineBreakSingleBlock(t,s){if(t){const e=new Q(k(),"\n",this),i=t.text.slice(0,s),n=t.text.slice(s),r=this.nodes.indexOf(t);if(r>-1){const s=this.nodes.slice(0,r),h=this.nodes.slice(r+1);i&&s.push(t.cloneWithText(i)),n&&h.unshift(t.cloneWithText(n)),this.mergeLineBreakNodes(s,e,h)}return e}}lineBreakMultipleBlocks(t){const s=this.nodes,e=new Q(k(),"\n",this),i=this.concatBlocksNodes(t.slice(1));return this.mergeLineBreakNodes(s,e,i),e}deleteNodeContent(t){const s=t.startContainerNode,e=t.startOffset;if(0!==e&&!s.isEmpty()){const i=s.text.slice(0,e-1)+s.text.slice(e);if(s.apply(new q(i)),i)return void(t.previousNode=s);{const e=this.getPreviousNode(s);return e&&e.parentBlock===this&&"\n"===e.text||1===this.nodes.length?void(t.previousNode=s):(this.apply(new N(s)),void(t.previousNode=e))}}{let e=this.getPreviousNode(s),i=null;if(this.nodes.length&&e&&e.parentBlock!==this)s.isEmpty()&&this.apply(new N(s)),e.parentBlock.apply(new tt(this));else if(this.isContentFirstNode(s)&&s.isEmpty()&&(i=this.getNextNode(s)),s.isEmpty()&&this.apply(new N(s)),e instanceof Q&&e.isEmpty()){const t=e;e=this.getPreviousNode(e),t.parentBlock.apply(new N(t)),e||(i=s)}0===this.nodes.length&&this.parent.apply(new N(this)),e?t.previousNode=e:i&&(t.nextNode=i)}}removeChildNode(t){this.nodes=this.nodes.filter((s=>s!==t.entityToBeRemoved)),0===this.nodes.length&&this.parent.apply(new N(this))}mergeLineBreakNodes(t,s,e){(0===e.length||e[0]&&""===e[0].text)&&e.push(new Q(k(),"\n",this,t[t.length-1]&&t[t.length-1].annotationMap)),this.apply(new j([...t,s,...e]))}breakSingleTextBlock(t,s){const e=this.copyInlineStyleToNewParagraph(t);if(this.isCaretPositionAtEnd(t,s))this.parent.apply(new v(this,e));else{if(!this.isCaretPositionAtStart(t,s)){const e=new L(t,s);return this.apply(e),e.newBlock}this.parent.apply(new st(this,e))}return e}convertParagraphToList(t){const s=this.parent.createList(t.listType),e=t.selectedBlocks.map((t=>this.parent.toListItem(t)));s.apply(new y(e)),this.parent.apply(new v(t.selectedBlocks[0],s)),t.selectedBlocks.forEach((t=>{t.parent.apply(new N(t))}))}insertImage(t){const s=t.splitPointNode,e=t.startOffsetOfNode,i=t.imageBlockToBeInserted;if(this.isCaretPositionAtEnd(s,e))this.parent.apply(new v(this,i));else if(this.isCaretPositionAtStart(s,e))this.parent.apply(new st(this,i));else{const t=new L(s,e);this.apply(t),this.parent.apply(new v(this,i))}}copyInlineStyleToNewParagraph(t){const s=t.cloneWithText("");s.annotationMap.delete(h.LINK);const e=new et(k(),"paragraph");return e.apply(new y([s])),e}}class it extends S{constructor(t){super(t),this.type="image",this.nodes=[]}static from(t){const s=new it(t.id),{annotations:e}=t;return s.nodes=t.nodes.map((t=>C.from(t,s))),e&&Object.entries(e).forEach((([t,e])=>{const i=this.createAnnotationEntity(t,e);b(i)&&s.annotationMap.set(...i)})),s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{type:"image",nodes:this.nodes.map((t=>t.toJSON()))})}isNotEmpty(){return this.nodes.length>0&&this.nodes.some((t=>t.url.length>0))}getLastNode(){return this.nodes[this.nodes.length-1]}doModifyActionApply(t){switch(t.type){case i.DELETE_CHILD:this.removeChildNode(t);break;case i.CLEAR_CHILD_NODES:this.nodes=[];break;case i.APPEND_CHILD_NODES:this.appendChildNodes(t.entityToBeAppended);break;case i.REPLACE_CHILD_NODES:this.nodes=[],this.appendChildNodes(t.newChildNodes);break;case i.SPLIT_BLOCK_WITH_NODE:t.newBlock=this.splitImageNodes(t.splitPointNode,t.startOffsetOfNode);break;case i.MERGE_TWO_BLOCKS_NODES:this.mergeTwoBlocksNodes(t.blockNeedToBeMerged);break;case i.BREAK_SINGLE_BLOCK:t.newBlock=this.breakSingleBlock(t.startContainerNode,t.startOffset);break;case i.LINE_BREAK_SINGLE_BLOCK:t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset);break;case i.LINE_BREAK_MULTIPLE_BLOCKS:t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks);break;case i.DELETE_BLOCK_CONTENT:this.deleteNodeContent(t);break;case i.INSERT_IMAGE_TO_BLOCK:this.insertImage(t);break;case i.INSERT_NODES_AFTER:this.replaceNodeWithNodes(t.referNode,[t.referNode,...t.nodesToBeInserted]);break;case i.INSERT_NODES_BEFORE:this.replaceNodeWithNodes(t.referNode,[...t.nodesToBeInserted,t.referNode])}}removeChildNode(t){this.nodes=this.nodes.filter((s=>s!==t.entityToBeRemoved)),0===this.nodes.length&&this.parent.apply(new N(this))}splitImageNodes(t,s){const e=this.nodes.indexOf(t);if(e>-1){const t=this.nodes.slice(0,e+s),i=this.nodes.slice(e+s);this.apply(new j(t));const n=this.cloneWithNodes(i);return this.parent.apply(new v(this,n)),n}}cloneWithNodes(t){const s=new it(k());return s.nodes=[],s.apply(new y(t)),s}breakSingleBlock(t,s){const e=et.from({id:k(),type:"paragraph",nodes:[{id:k(),type:"text",text:""}]});if(this.isCaretPositionAtEnd(t,s))this.parent.apply(new v(this,e));else{if(!this.isCaretPositionAtStart(t,s)){const e=new L(t,s);return this.apply(e),e.newBlock}this.parent.apply(new st(this,e))}return e}lineBreakSingleBlock(t,s){const e=this.breakSingleBlock(t,s);if(e)return e.nodes[0]}isCaretPositionAtStart(t,s){return t===this.nodes[0]&&0===s}isCaretPositionAtEnd(t,s){return t===this.nodes[this.nodes.length-1]&&1===s}lineBreakMultipleBlocks(t){const s=et.from({id:k(),type:"paragraph",nodes:[{id:k(),type:"text",text:"\n"}]});this.parent.apply(new v(this,s));const e=this.concatBlocksNodes(t.slice(1));return(0===e.length||e[0]&&""===e[0].text)&&e.push(new Q(k(),"\n",s)),s.apply(new y(e)),s.nodes[0]}deleteNodeContent(t){const s=t.startContainerNode,e=t.startOffset;let i=this.getPreviousNode(s),n=null;if(1===e){const t=s.parentBlock;this.isContentFirstNode(s)&&(n=this.getNextNode(s)),1===t.nodes.length?t.parent.apply(new N(t)):s.parentBlock.apply(new N(s))}else{const e=i;e&&e instanceof C&&(i=this.getPreviousNode(e),e.parentBlock.apply(new N(e)),i||(t.nextNode=s))}i?t.previousNode=i:n&&(t.nextNode=n)}insertImage(t){const s=t.splitPointNode,e=t.startOffsetOfNode,i=t.imageBlockToBeInserted;this.nodes.length<1?this.apply(new y(t.imageBlockToBeInserted.nodes)):this.isCaretPositionAtEnd(s,e)?this.parent.apply(new v(this,i)):this.isCaretPositionAtStart(s,e)?this.parent.apply(new st(this,i)):(this.apply(new L(s,e)),this.parent.apply(new v(this,i)))}}class nt extends et{constructor(t,s){super(t,"list-item"),this.children=[],this.children=s}static from(t){const s=new nt(t.id);s.nodes=t.nodes.map((t=>Q.from(t,s))),t.children&&(s.children=t.children.map((t=>{const e=ht.from(t);return e.parent=s,e})));const{annotations:e}=t;return e&&Object.entries(e).forEach((([t,e])=>{const i=this.createAnnotationEntity(t,e);b(i)&&s.annotationMap.set(...i)})),s}toJSON(){var t;return Object.assign(Object.assign({},super.toJSON()),{type:"list-item",children:null===(t=this.children)||void 0===t?void 0:t.map((t=>t.toJSON()))})}cloneWithNodes(t){const s=new nt(k());return s.nodes=[],s.apply(new y(t)),s}isNotEmpty(){return this.children?super.isNotEmpty()||this.children.some((t=>t.isNotEmpty())):super.isNotEmpty()}getLastNode(){return this.children&&this.children.length>0?this.children[this.children.length-1].getLastNode():super.getLastNode()}doModifyActionApply(t){switch(t.type){case i.DELETE_CHILD:this.removeListChildNode(t);break;case i.DELETE_NEST_LIST:this.removeNestList(t);break;case i.APPEND_CHILD_NODES:this.appendChildNodes(t.entityToBeAppended);break;case i.CLEAR_CHILD_NODES:this.nodes=[];break;case i.SPLIT_BLOCK_WITH_NODE:this.splitListItemBlock(t);break;case i.REPLACE_CHILD_NODES:this.nodes=[],this.appendChildNodes(t.newChildNodes);break;case i.REPLACE_NEST_LIST:this.replaceNestList(t.newList);break;case i.MERGE_TWO_BLOCKS_NODES:this.mergeTwoBlocksNodes(t.blockNeedToBeMerged);break;case i.BREAK_SINGLE_BLOCK:t.newBlock=this.breakSingleListItemBlock(t.startContainerNode,t.startOffset);break;case i.LINE_BREAK_SINGLE_BLOCK:t.lineBreakNode=this.lineBreakSingleBlock(t.startContainerNode,t.startOffset);break;case i.LINE_BREAK_MULTIPLE_BLOCKS:t.lineBreakNode=this.lineBreakMultipleBlocks(t.selectedBlocks);break;case i.DELETE_BLOCK_CONTENT:this.deleteListNodeContent(t);break;case i.INSERT_IMAGE_TO_BLOCK:this.parent.apply(t);break;case i.INSERT_NODES_BEFORE:this.replaceNodeWithNodes(t.referNode,[...t.nodesToBeInserted,t.referNode])}}removeListChildNode(t){this.nodes=this.nodes.filter((s=>s!==t.entityToBeRemoved)),0!==this.nodes.length||this.children&&this.children.length||this.parent.apply(new N(this))}removeNestList(t){this.children&&(this.children=this.children.length>1?this.children.filter((s=>s!==t.nestListBlockToBeRemoved)):void 0)}replaceNestList(t){t.forEach((t=>{t.parent=this})),this.children=t}splitListItemBlock(t){t.newBlock=this.splitTextNodeBlock(t.splitPointNode,t.startOffsetOfNode)}breakSingleListItemBlock(t,s){const e=new nt(k()),i=this.copyInlineStyleToNewNode(t);if(e.apply(new y([i])),this.isCaretPositionAtEnd(t,s))return this.breakListItemAtEnd(e);if(!this.isCaretPositionAtStart(t,s)){const e=new L(t,s);return this.apply(e),e.newBlock}return this.parent.apply(new st(this,e)),e}breakListItemAtEnd(t){const s=this.parent.blocks[this.parent.blocks.length-1],e=1===this.nodes.length&&this.nodes[0].isEmpty();if(this===s&&e){const s=this.parent.parent;if("list-item"!==s.type){const e=et.from({id:k(),type:"paragraph",nodes:[]});return e.apply(new y(t.nodes)),s.apply(new v(this.parent,e)),this.parent.apply(new N(this)),e}s.parent.apply(new v(s,t)),this.parent.apply(new N(this))}else this.parent.apply(new v(this,t));return t}deleteListNodeContent(t){const s=t.startContainerNode.parentBlock.parent;this.deleteNodeContent(t),0===s.blocks.length&&s.parent.apply(new N(s))}copyInlineStyleToNewNode(t){const s=t.cloneWithText("");return s.annotationMap.delete(h.LINK),s}}class rt extends e{constructor(t){super(),this.type=i.DELETE_NEST_LIST,this.nestListBlockToBeRemoved=t}}class ht extends S{constructor(t,s){super(t),this.type="bullet-list",this.blocks=[],this.type=s}static from(t){const s=new ht(t.id,t.type);return s.blocks=t.blocks.map((t=>{const e=nt.from(t);return e.parent=s,e})),s}toJSON(){return Object.assign(Object.assign({},super.toJSON()),{id:this.id,type:this.type,blocks:this.blocks.map((t=>t.toJSON()))})}isNotEmpty(){return this.blocks.length>0&&this.blocks.some((t=>t.isNotEmpty()))}getLastNode(){return this.blocks[this.blocks.length-1].getLastNode()}doModifyActionApply(t){switch(t.type){case i.DELETE_CHILD:this.removeListItemBlock(t.entityToBeRemoved);break;case i.INSERT_BLOCKS_AFTER:this.replaceBlockWithBlocks(t.referBlock,[t.referBlock,...t.blocksToBeInserted]);break;case i.INSERT_BLOCKS_BEFORE:this.replaceBlockWithBlocks(t.referBlock,[...t.blocksToBeInserted,t.referBlock]);break;case i.APPEND_CHILD_NODES:this.appendChildBlocks(t.entityToBeAppended);break;case i.TRANSFORM_LIST_BLOCK:this.convertToList(t);break;case i.TRANSFORM_PARAGRAPH_BLOCK:this.convertToParagraph(t);break;case i.INSERT_IMAGE_TO_BLOCK:this.insertImage(t)}}toParagraph(t){const s=new et(k(),"paragraph");return s.apply(new y(t.nodes)),s.annotationMap=t.annotationMap,s}convertToList(t){const s=t.selectedBlocks,e=this.parent.createList(t.listType);if(s.every((t=>t.parent===this)))e.apply(new y(this.blocks)),this.parent.apply(new v(this,e)),this.parent.apply(new N(this)),s.forEach((t=>t.nodes.map((t=>t.apply(new Z)))));else{const s=t.selectedBlocks.map((t=>this.parent.toListItem(t)));e.apply(new y(s)),this.parent.apply(new v(this,e)),t.selectedBlocks.forEach((t=>{t.parent.apply(new N(t))})),0===this.blocks.length&&this.parent.apply(new N(this))}}convertToParagraph(t){let s=!1,e=!1;const i=t.selectedBlocks,n=i.map((t=>(t.nodes.map((t=>t.apply(new Z))),t===this.blocks[0]&&(s=!0),t===this.blocks[this.blocks.length-1]&&(e=!0),this.toParagraph(t))));if(s)this.parent.apply(new st(this,...n));else if(e)this.parent.apply(new v(this,...n));else{const t=this.blocks.indexOf(i[0]),s=this.blocks.indexOf(i[i.length-1]),e=this.parent.createList(this.type);e.apply(new y(this.blocks.slice(0,t)));const r=this.parent.createList(this.type);r.apply(new y(this.blocks.slice(s+1))),this.parent.apply(new st(this,e,...n,r)),this.parent.apply(new N(this))}i.map((t=>{this.apply(new N(t))})),0===this.blocks.length&&this.parent.apply(new N(this))}insertImage(t){this.parent.apply("list-item"!==this.parent.type?new v(this,t.imageBlockToBeInserted):t)}removeListItemBlock(t){super.removeChildBlock(t),0===this.blocks.length&&this.parent&&this.parent.apply(this.parent instanceof nt?new rt(this):new N(this))}}class ot extends x{constructor(t){super(),t.forEach((t=>{t.parent=this})),this.blocks=t}static fromJSON(t){const s=t.map((t=>{switch(t.type){case"paragraph":case"title":case"subtitle":case"heading-1":case"heading-2":case"heading-3":return et.from(t);case"image":return it.from(t);case"bullet-list":case"number-list":return ht.from(t);default:throw new Error(`[Vega] Unknown block type: ${t.type}`)}}));return new ot(s)}static createEmptyContent(){return ot.fromJSON([{id:k(),type:"paragraph",nodes:[{id:k(),type:"text",text:""}]}])}clone(){return new ot([...this.blocks])}toJSON(){return this.blocks.map((t=>t.toJSON()))}apply(t){switch(t.type){case i.DELETE_CHILD:this.removeChildBlock(t.entityToBeRemoved);break;case i.APPEND_CHILD_NODES:this.appendChildBlocks(t.entityToBeAppended);break;case i.INSERT_BLOCKS_AFTER:this.replaceBlockWithBlocks(t.referBlock,[t.referBlock,...t.blocksToBeInserted]);break;case i.INSERT_BLOCKS_BEFORE:this.replaceBlockWithBlocks(t.referBlock,[...t.blocksToBeInserted,t.referBlock])}}toListItem(t){t.nodes.map((t=>t.apply(new Z)));const s=new nt(k());return s.apply(new y(t.nodes)),s.annotationMap=t.annotationMap,s}createList(t){return new ht(k(),t)}}export{E as A,_ as B,U as C,m as H,B as I,V as L,tt as M,et as R,M as S,I as T,T as U,ot as V,A as Z,it as a,nt as b,ht as c,S as d,C as e,Q as f,H as g,O as h,F as i,Y as j,X as k,W as l,K as m,J as n,g as o,y as p,q,L as r,N as s,j as t,st as u,v}
|
package/dist/vega/p-5f377954.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var t;!function(t){t.Angular="angular",t.Vue="vue",t.React="react",t.Next="next",t.VanillaJs="vanilla-js"}(t||(t={}));const s=new class{constructor(){this.vegaVersion="2.37.
|
|
1
|
+
var t;!function(t){t.Angular="angular",t.Vue="vue",t.React="react",t.Next="next",t.VanillaJs="vanilla-js"}(t||(t={}));const s=new class{constructor(){this.vegaVersion="2.37.2",this.framework=t.VanillaJs}getVegaEnv(){return{version:this.vegaVersion,framework:this.framework}}setVegaFramework(t){this.framework=t}};export{t as F,s as v}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as e,F as t,r,c as o,H as i,g as a}from"./p-1c298d5a.js";import{s as l}from"./p-9b797118.js";import{c as s,V as n,M as c,I as d}from"./p-6e1ab235.js";import{V as v,I as h}from"./p-4387d550.js";import{V as p}from"./p-8284a445.js";import{D as f}from"./p-d7219734.js";import{a as g,f as u,r as b,s as m,t as x,u as w}from"./p-7c37e5bb.js";import{g as C}from"./p-33b62194.js";import{c as y}from"./p-86194314.js";import{t as j}from"./p-aacf6920.js";import{c as F}from"./p-57669fd6.js";import{C as R}from"./p-2d0d575f.js";import{b as L}from"./p-5dce8dfe.js";import{F as k}from"./p-7da8b05f.js";import{R as z}from"./p-3152031c.js";import{T as E}from"./p-9ab547b0.js";import"./p-032df16f.js";import"./p-331a62d5.js";import"./p-79ec5d69.js";import"./p-6a334573.js";import"./p-1b860f90.js";import"./p-0bb29d98.js";import"./p-fe9644a0.js";import"./p-483c483a.js";import"./p-5f589974.js";import"./p-4bcd6612.js";import"./p-74168615.js";import"./p-ed45b3b6.js";import"./p-987fbbd0.js";import"./p-a9354a5c.js";import"./p-b0502d01.js";import"./p-262ec334.js";var M=function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};class V extends n{render(){return e(t,null,e("vega-field-label",{isFieldRequired:this.required,disabled:this.disabled,label:this.label}),this.vegaFileUploaderContainerRenderer.render(),this.hint?e("vega-hint",null,this.hint):null,this.vegaFileUploaderFileListRenderer.render())}}M([s()],V.prototype,"required",void 0),M([s()],V.prototype,"disabled",void 0),M([s()],V.prototype,"label",void 0),M([s()],V.prototype,"hint",void 0),M([s()],V.prototype,"vegaFileUploaderContainerRenderer",void 0),M([s()],V.prototype,"vegaFileUploaderFileListRenderer",void 0);var I=function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};class O extends n{constructor(){super(...arguments),this.handleDropAreaClick=e=>{e.stopPropagation(),this.shouldDisableUploadButton()||this.triggerFileInputClick()},this.triggerFileInputClick=()=>{this.inputElementRef.click()},this.inputChangeHandler=e=>{e.stopPropagation();const t=this.getVegaFilesFromFileList(e.target.files);this.selectFileChangeEventEmitHandler(this.filterExceedLimitFiles(t)),this.inputElementRef.value=""},this.dropHandler=e=>{var t;if(e.preventDefault(),!this.shouldDisableUploadButton()){const r=this.getVegaFilesFromFileList(this.dropFileFilterController.process(null===(t=e.dataTransfer)||void 0===t?void 0:t.files));this.selectFileChangeEventEmitHandler(this.filterExceedLimitFiles(r))}}}getUploaderContainerRef(){return this.uploaderContainerRef}render(){return e("div",{class:"vega-file-uploader-container",ref:e=>this.uploaderContainerRef=e},e("input",{onChange:this.inputChangeHandler,type:"file",multiple:!this.fileLimitController.isSingleMode(),accept:this.accept,style:{display:"none"},ref:e=>this.inputElementRef=e}),"uploadButton"===this.variant?this.renderUploadButton():this.renderUploadDropArea())}renderUploadButton(){return e("vega-button",{label:"Upload Document",icon:p.getIconKey("arrow-up-from-line"),variant:"secondary",size:"small",disabled:this.shouldDisableUploadButton(),ref:e=>{f.addUniqueObserverToNode(e,g,this.triggerFileInputClick)}})}renderUploadDropArea(){return e("vega-box",{class:{"vega-file-upload-area":!0,disabled:this.shouldDisableUploadButton()},padding:"size-24",border:"border-input-field",borderStyle:"dashed",backgroundColor:"bg-tertiary",corners:"rounded-8",tabIndex:0,onDrop:this.dropHandler,onDragEnter:this.preventDefaultBehavior,onDragOver:this.preventDefaultBehavior,onClick:this.handleDropAreaClick,onKeyDown:y()},e("vega-flex",{gap:"size-8",alignItems:"center",justifyContent:"center"},e("vega-icon",{color:"text-link",icon:p.getIconKey("arrow-up-from-line")}),e("vega-font",{color:"text-link",variant:"font-btn-label"},this.translationSlimmer.t("Select or drop your file here"))))}preventDefaultBehavior(e){e.preventDefault()}selectFileChangeEventEmitHandler(e){e&&e.length&&(this.selectFileChangeEventEmitter.emit(e).defaultPrevented||this.vegaFileUploaderValueController.setValue(this.value&&this.value.length?(new Array).concat(this.value,e):e))}getVegaFilesFromFileList(e){const t=[];return e&&e.length&&Array.from(e).map((e=>{t.push({key:C(),name:e.name,url:e})})),t}shouldDisableUploadButton(){return this.disabled||!!(this.value&&this.maxCount&&this.value.length>=this.maxCount)}filterExceedLimitFiles(e){const t=Number(this.maxCount);if(!isNaN(t)&&t&&e.length){const r=Math.max(0,t-(this.value?this.value.length:0));return e.slice(0,r)}return e}}p.register({"arrow-up-from-line":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M214.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 141.3V208 320c0 17.7 14.3 32 32 32s32-14.3 32-32V208 141.3l73.4 73.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-128-128zM32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32H352c17.7 0 32-14.3 32-32s-14.3-32-32-32H32z"/></svg>'}}),I([s()],O.prototype,"variant",void 0),I([s()],O.prototype,"accept",void 0),I([s()],O.prototype,"disabled",void 0),I([s()],O.prototype,"value",void 0),I([s()],O.prototype,"selectFileChangeEventEmitter",void 0),I([s()],O.prototype,"vegaFileUploaderValueController",void 0),I([s()],O.prototype,"dropFileFilterController",void 0),I([s()],O.prototype,"translationSlimmer",void 0),I([s()],O.prototype,"fileLimitController",void 0),I([s()],O.prototype,"maxCount",void 0);var U=function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};class A extends n{constructor(){super(...arguments),this.fileRemoveHandler=e=>{this.removeEventEmitter.emit(e).defaultPrevented||this.vegaFileUploaderValueController.setValue(this.value.filter((t=>t!==e)))},this.fileReUploadHandler=e=>{this.retryEventEmitter.emit(e)},this.filePreviewHandler=e=>{this.previewEventEmitter.emit(e)}}render(){const t=!this.value||this.value.length<1;return e("div",{class:{"vega-file-uploader-file-list":!0,"vega-file-list-hidden":t}},!t&&this.value.map((t=>e("vega-box",{key:t.key,class:"vega-file-uploader-file",padding:"size-8",corners:"rounded-8"},e("vega-flex",{alignItems:"start",justifyContent:"space-between"},e("vega-flex",{class:"vega-file-status-and-name",gap:"size-8",alignItems:"start"},e("div",{style:{paddingTop:"3px"}},this.vegaFileUploaderFileStatusRenderer.render(t.status,t.uploadingPercent)),e("vega-flex",{gap:"size-4",direction:"col"},e("vega-font",{color:"done"===t.status||"error"===t.status?"text-primary":"text-secondary",variant:"font-field-label"},t.name),"error"===t.status&&t.errorMessage&&e("vega-font",{color:"text-error",variant:"font-footnote1-short"},t.errorMessage))),e("vega-flex",{gap:"size-4",class:"vega-file-list-buttons",justifyContent:"end"},t.previewable&&e("vega-button-circle",{class:"vega-file-preview-button",variant:"icon-only",size:"small",icon:"zoom-in",iconColor:"text-secondary",label:"Preview",tooltip:{disableInteractive:!0},ref:e=>{f.addUniqueObserverToNode(e,g,(()=>{this.filePreviewHandler(t)}))}}),"error"===t.status&&e("vega-button-circle",{variant:"icon-only",size:"small",icon:p.getIconKey("arrow-rotate-right"),iconColor:"text-secondary",label:"Retry",tooltip:{disableInteractive:!0},disabled:this.disabled,ref:e=>{f.addUniqueObserverToNode(e,g,(()=>{this.fileReUploadHandler(t)}))}}),e("vega-button-circle",{variant:"icon-only",size:"small",icon:p.getIconKey("trash-can"),iconColor:"text-secondary",label:"Delete",tooltip:{disableInteractive:!0},disabled:this.disabled,ref:e=>{f.addUniqueObserverToNode(e,g,(()=>{this.fileRemoveHandler(t)}))}})))))))}}p.register({"trash-can":j,"arrow-rotate-right":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M456 224c13.3 0 24-10.7 24-24V56c0-13.3-10.7-24-24-24s-24 10.7-24 24v80.1l-20-23.5C371 63.4 309.1 32 240 32C116.3 32 16 132.3 16 256s100.3 224 224 224c50.4 0 97-16.7 134.4-44.8c10.6-8 12.7-23 4.8-33.6s-23-12.7-33.6-4.8C316.2 418.9 279.7 432 240 432c-97.2 0-176-78.8-176-176s78.8-176 176-176c54.3 0 102.9 24.6 135.2 63.4l.1 .2 0 0L402.9 176H312c-13.3 0-24 10.7-24 24s10.7 24 24 24H456z"/></svg>'}}),U([s()],A.prototype,"value",void 0),U([s()],A.prototype,"disabled",void 0),U([s()],A.prototype,"vegaFileUploaderFileStatusRenderer",void 0),U([s()],A.prototype,"removeEventEmitter",void 0),U([s()],A.prototype,"vegaFileUploaderValueController",void 0),U([s()],A.prototype,"retryEventEmitter",void 0),U([s()],A.prototype,"previewEventEmitter",void 0);class D extends n{render(t,r){switch(t){case"uploading":return e("vega-loading-indicator",Object.assign({class:"vega-file-list-status",mode:r?"determinate":"indeterminate",size:"micro"},r?{percent:r}:{}));case"done":return e("vega-icon",{class:"vega-file-list-status",color:"text-success",icon:p.getIconKey("circle-check-regular")});case"error":return e("vega-icon",{class:"vega-file-list-status",color:"text-error",icon:p.getIconKey("circle-xmark")});default:return e("vega-loading-indicator",{class:"vega-file-list-status",mode:"determinate",size:"micro"})}}}p.register({"circle-check-regular":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M243.8 339.8C232.9 350.7 215.1 350.7 204.2 339.8L140.2 275.8C129.3 264.9 129.3 247.1 140.2 236.2C151.1 225.3 168.9 225.3 179.8 236.2L224 280.4L332.2 172.2C343.1 161.3 360.9 161.3 371.8 172.2C382.7 183.1 382.7 200.9 371.8 211.8L243.8 339.8zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 48C141.1 48 48 141.1 48 256C48 370.9 141.1 464 256 464C370.9 464 464 370.9 464 256C464 141.1 370.9 48 256 48z"/></svg>'},"circle-xmark":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M175 175C184.4 165.7 199.6 165.7 208.1 175L255.1 222.1L303 175C312.4 165.7 327.6 165.7 336.1 175C346.3 184.4 346.3 199.6 336.1 208.1L289.9 255.1L336.1 303C346.3 312.4 346.3 327.6 336.1 336.1C327.6 346.3 312.4 346.3 303 336.1L255.1 289.9L208.1 336.1C199.6 346.3 184.4 346.3 175 336.1C165.7 327.6 165.7 312.4 175 303L222.1 255.1L175 208.1C165.7 199.6 165.7 184.4 175 175V175zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 48C141.1 48 48 141.1 48 256C48 370.9 141.1 464 256 464C370.9 464 464 370.9 464 256C464 141.1 370.9 48 256 48z"/></svg>'}});var S=function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};class B extends n{valueChangeHandler(e){!e||Array.isArray(e)?(this.changeEventEmitter.emit(e),R.notify(L,{host:this.host,detail:this.value})):e&&!Array.isArray(e)&&this.setValue(null)}setValue(e){this.value=e}}S([s()],B.prototype,"host",void 0),S([s({writable:!0})],B.prototype,"value",void 0),S([s()],B.prototype,"changeEventEmitter",void 0),S([c("watchValue")],B.prototype,"valueChangeHandler",null);class H extends z{constructor(){super(...arguments),this.checkArrayItemType=e=>!(!e||"object"!=typeof e)}}class N extends n{process(e){const t=Array.from(e||[]);if(e&&this.accept&&"*"!==this.accept&&"/*"!==this.accept){const e=this.accept.split(",");return t.filter((t=>this.validateFileType(t,e)))}return t}validateFileType(e,t){const r=e.name,o=(e.type||"").toLowerCase(),i=o.replace(/\/.*$/,"");return t.some((e=>(e=e.trim().toLowerCase()).startsWith(".")?r.toLowerCase().endsWith(e):e.endsWith("/*")?i===e.replace(/\/.*$/,""):o===e))}}!function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);a>3&&l&&Object.defineProperty(t,r,l)}([s()],N.prototype,"accept",void 0);var P=function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};class q extends n{isSingleMode(){return 1===Number(this.maxCount)}checkMaxCount(){null!==this.maxCount&&this.maxCount<1&&(this.maxCount=null)}}P([s({writable:!0})],q.prototype,"maxCount",void 0),P([c("componentDidLoad"),c("watchMaxCount")],q.prototype,"checkMaxCount",null);var G=function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};const T=class{constructor(e){r(this,e),this.vegaChange=o(this,"vegaChange",7),this.change=o(this,"change",7),this.vegaSelectedFileChange=o(this,"vegaSelectedFileChange",7),this.selectedFileChange=o(this,"selectedFileChange",7),this.vegaRemove=o(this,"vegaRemove",7),this.remove=o(this,"remove",7),this.vegaRetry=o(this,"vegaRetry",7),this.retry=o(this,"retry",7),this.vegaPreview=o(this,"vegaPreview",7),this.preview=o(this,"preview",7),this.globalSlimmers={},this.translationSlimmer=new E,this.vegaComponentUsageRuntimeMetricsSlimmer=new v,this.formFieldController=new k({propertyRules:[{propertyName:"required",ruleFactory:e=>e?new H:null}],validationRulesName:"validationRules",defaultValue:[],attributeGetter:e=>this[e],inputContainerGetter:()=>this.vegaFileUploaderContainerRenderer.getUploaderContainerRef(),touchableAreaGetter:()=>[this.vegaFileUploaderContainerRenderer.getUploaderContainerRef()]}),this.vegaFileUploaderRenderer=new V,this.vegaFileUploaderContainerRenderer=new O,this.vegaFileUploaderFileListRenderer=new A,this.vegaFileUploaderFileStatusRenderer=new D,this.vegaFileUploaderValueController=new B,this.dropFileFilterController=new N,this.fileLimitController=new q,this.changeEventEmitter=F(T,u),this.selectFileChangeEventEmitter=F(T,b),this.removeEventEmitter=F(T,m),this.retryEventEmitter=F(T,x),this.previewEventEmitter=F(T,w),this.label="",this.variant="uploadArea",this.hint="",this.value=[],this.disabled=!1,this.maxCount=null,this.required=!1,this.validationRules=[],this.autoValidation=!0,this.isValid=null}watchValue(e){}watchMaxCount(){}watchValidationRules(){}render(){return l(e(i,null,this.vegaFileUploaderRenderer.render()),this.host)}get host(){return a(this)}static get watchers(){return{value:["watchValue"],maxCount:["watchMaxCount"],validationRules:["watchValidationRules"]}}};G([h()],T.prototype,"globalSlimmers",void 0),G([d()],T.prototype,"translationSlimmer",void 0),G([d()],T.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),G([d()],T.prototype,"formFieldController",void 0),G([d()],T.prototype,"vegaFileUploaderRenderer",void 0),G([d()],T.prototype,"vegaFileUploaderContainerRenderer",void 0),G([d()],T.prototype,"vegaFileUploaderFileListRenderer",void 0),G([d()],T.prototype,"vegaFileUploaderFileStatusRenderer",void 0),G([d()],T.prototype,"vegaFileUploaderValueController",void 0),G([d()],T.prototype,"dropFileFilterController",void 0),G([d()],T.prototype,"fileLimitController",void 0),G([d()],T.prototype,"changeEventEmitter",void 0),G([d()],T.prototype,"selectFileChangeEventEmitter",void 0),G([d()],T.prototype,"removeEventEmitter",void 0),G([d()],T.prototype,"retryEventEmitter",void 0),G([d()],T.prototype,"previewEventEmitter",void 0),T.style=':host{display:inline-block;text-align:left;width:100%;line-height:normal}:host .vega-file-uploader-container .vega-file-upload-area{text-align:center}:host .vega-file-uploader-container .vega-file-upload-area:hover{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border-color:rgba(var(--v-border-color-input-field-hover, 115, 160, 190, 1))}:host .vega-file-uploader-container .vega-file-upload-area:hover vega-icon,:host .vega-file-uploader-container .vega-file-upload-area:hover vega-font{color:rgba(var(--v-text-link-hover, 4, 112, 236, 1))}:host .vega-file-uploader-container .vega-file-upload-area:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px}:host .vega-file-uploader-container .vega-file-upload-area:active{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border-color:rgba(var(--v-border-color-action-active, 29, 65, 195, 1))}:host .vega-file-uploader-container .vega-file-upload-area:active vega-icon,:host .vega-file-uploader-container .vega-file-upload-area:active vega-font{color:rgba(var(--v-text-link-active, 29, 65, 195, 1))}:host .vega-file-uploader-container .vega-file-upload-area.disabled{border-color:rgba(var(--v-border-color-input-field-disabled, 222, 225, 227, 1));background-color:rgba(var(--v-bg-tertiary, 240, 243, 247, 1));outline:none}:host .vega-file-uploader-container .vega-file-upload-area.disabled vega-icon,:host .vega-file-uploader-container .vega-file-upload-area.disabled vega-font{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}:host .vega-file-uploader-container vega-button::part(button):focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px;box-shadow:0 0 0}:host .vega-file-uploader-container.error .vega-file-upload-area{border-color:rgba(var(--v-border-color-input-field-danger, 230, 50, 87, 1))}:host .vega-file-uploader-container.error .vega-file-upload-area:hover{border-color:rgba(var(--v-border-color-input-field-danger-hover, 255, 87, 114, 1))}:host .vega-file-uploader-container.error .vega-file-upload-area:focus-visible{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:2px}:host .vega-file-uploader-container.error .vega-file-upload-area:active{border-color:rgba(var(--v-border-color-input-field-danger-hover, 255, 87, 114, 1))}:host .vega-file-uploader-container.error vega-button::part(button),:host .vega-file-uploader-container.error vega-button::part(button):hover{color:rgba(var(--v-text-danger-link, 230, 50, 87, 1));border-color:rgba(var(--v-border-color-danger, 230, 50, 87, 1))}:host .vega-file-uploader-container.error vega-button::part(button):hover{background-color:rgba(var(--v-bg-danger-tertiary-hover, 255, 87, 114, 0.2));border-color:rgba(var(--v-border-color-danger-hover, 255, 87, 114, 1));color:rgba(var(--v-text-danger-link-hover, 233, 71, 104, 1))}:host .vega-file-uploader-container.error vega-button::part(button):focus-visible{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:2px;box-shadow:0 0 0}:host .vega-file-uploader-container.error vega-button::part(button):active{color:rgba(var(--v-text-danger-link-active, 189, 41, 71, 1));border-color:rgba(var(--v-border-color-danger-active, 189, 41, 71, 1));background-color:rgba(var(--v-bg-danger-tertiary-active, 189, 41, 71, 0.2))}:host .vega-file-uploader-file-list .vega-file-uploader-file .vega-file-preview-button{visibility:hidden}:host .vega-file-uploader-file-list .vega-file-uploader-file:hover{background-color:rgba(var(--v-bg-action-tertiary-hover, 4, 4, 28, 0.05))}:host .vega-file-uploader-file-list .vega-file-uploader-file:hover .vega-file-preview-button{visibility:visible}:host .vega-file-uploader-file-list .vega-file-list-buttons{margin-left:8px;flex-shrink:0}:host .vega-file-uploader-file-list .vega-file-list-status svg{width:16px;height:16px}:host .vega-file-uploader-file-list .vega-file-status-and-name{padding-top:5px}:host .vega-file-uploader-file-list .vega-file-status-and-name vega-font{word-break:break-word}:host vega-field-label{margin-bottom:8px}:host .vega-file-uploader-file-list{margin-top:8px}:host .vega-file-uploader-file-list.vega-file-list-hidden{display:none}:host .vega-error{display:inline-block;padding-left:8px;padding-right:8px;padding-top:8px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .vega-hidden{display:none}';export{T as vega_file_uploader}
|
|
1
|
+
import{h as e,F as t,r,c as o,H as i,g as a}from"./p-1c298d5a.js";import{s as l}from"./p-9b797118.js";import{c as s,V as n,M as c,I as d}from"./p-6e1ab235.js";import{V as v,I as h}from"./p-4387d550.js";import{V as p}from"./p-8284a445.js";import{D as f}from"./p-d7219734.js";import{a as g,f as u,r as b,s as m,t as x,u as w}from"./p-7c37e5bb.js";import{g as C}from"./p-33b62194.js";import{c as y}from"./p-86194314.js";import{t as j}from"./p-aacf6920.js";import{c as F}from"./p-57669fd6.js";import{C as R}from"./p-2d0d575f.js";import{b as L}from"./p-5dce8dfe.js";import{F as k}from"./p-b517ed15.js";import{R as z}from"./p-3152031c.js";import{T as E}from"./p-9ab547b0.js";import"./p-032df16f.js";import"./p-331a62d5.js";import"./p-79ec5d69.js";import"./p-6a334573.js";import"./p-1b860f90.js";import"./p-0bb29d98.js";import"./p-348e95ba.js";import"./p-483c483a.js";import"./p-5f589974.js";import"./p-4bcd6612.js";import"./p-74168615.js";import"./p-ed45b3b6.js";import"./p-987fbbd0.js";import"./p-a9354a5c.js";import"./p-b0502d01.js";import"./p-262ec334.js";var M=function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};class V extends n{render(){return e(t,null,e("vega-field-label",{isFieldRequired:this.required,disabled:this.disabled,label:this.label}),this.vegaFileUploaderContainerRenderer.render(),this.hint?e("vega-hint",null,this.hint):null,this.vegaFileUploaderFileListRenderer.render())}}M([s()],V.prototype,"required",void 0),M([s()],V.prototype,"disabled",void 0),M([s()],V.prototype,"label",void 0),M([s()],V.prototype,"hint",void 0),M([s()],V.prototype,"vegaFileUploaderContainerRenderer",void 0),M([s()],V.prototype,"vegaFileUploaderFileListRenderer",void 0);var I=function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};class O extends n{constructor(){super(...arguments),this.handleDropAreaClick=e=>{e.stopPropagation(),this.shouldDisableUploadButton()||this.triggerFileInputClick()},this.triggerFileInputClick=()=>{this.inputElementRef.click()},this.inputChangeHandler=e=>{e.stopPropagation();const t=this.getVegaFilesFromFileList(e.target.files);this.selectFileChangeEventEmitHandler(this.filterExceedLimitFiles(t)),this.inputElementRef.value=""},this.dropHandler=e=>{var t;if(e.preventDefault(),!this.shouldDisableUploadButton()){const r=this.getVegaFilesFromFileList(this.dropFileFilterController.process(null===(t=e.dataTransfer)||void 0===t?void 0:t.files));this.selectFileChangeEventEmitHandler(this.filterExceedLimitFiles(r))}}}getUploaderContainerRef(){return this.uploaderContainerRef}render(){return e("div",{class:"vega-file-uploader-container",ref:e=>this.uploaderContainerRef=e},e("input",{onChange:this.inputChangeHandler,type:"file",multiple:!this.fileLimitController.isSingleMode(),accept:this.accept,style:{display:"none"},ref:e=>this.inputElementRef=e}),"uploadButton"===this.variant?this.renderUploadButton():this.renderUploadDropArea())}renderUploadButton(){return e("vega-button",{label:"Upload Document",icon:p.getIconKey("arrow-up-from-line"),variant:"secondary",size:"small",disabled:this.shouldDisableUploadButton(),ref:e=>{f.addUniqueObserverToNode(e,g,this.triggerFileInputClick)}})}renderUploadDropArea(){return e("vega-box",{class:{"vega-file-upload-area":!0,disabled:this.shouldDisableUploadButton()},padding:"size-24",border:"border-input-field",borderStyle:"dashed",backgroundColor:"bg-tertiary",corners:"rounded-8",tabIndex:0,onDrop:this.dropHandler,onDragEnter:this.preventDefaultBehavior,onDragOver:this.preventDefaultBehavior,onClick:this.handleDropAreaClick,onKeyDown:y()},e("vega-flex",{gap:"size-8",alignItems:"center",justifyContent:"center"},e("vega-icon",{color:"text-link",icon:p.getIconKey("arrow-up-from-line")}),e("vega-font",{color:"text-link",variant:"font-btn-label"},this.translationSlimmer.t("Select or drop your file here"))))}preventDefaultBehavior(e){e.preventDefault()}selectFileChangeEventEmitHandler(e){e&&e.length&&(this.selectFileChangeEventEmitter.emit(e).defaultPrevented||this.vegaFileUploaderValueController.setValue(this.value&&this.value.length?(new Array).concat(this.value,e):e))}getVegaFilesFromFileList(e){const t=[];return e&&e.length&&Array.from(e).map((e=>{t.push({key:C(),name:e.name,url:e})})),t}shouldDisableUploadButton(){return this.disabled||!!(this.value&&this.maxCount&&this.value.length>=this.maxCount)}filterExceedLimitFiles(e){const t=Number(this.maxCount);if(!isNaN(t)&&t&&e.length){const r=Math.max(0,t-(this.value?this.value.length:0));return e.slice(0,r)}return e}}p.register({"arrow-up-from-line":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M214.6 41.4c-12.5-12.5-32.8-12.5-45.3 0l-128 128c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 141.3V208 320c0 17.7 14.3 32 32 32s32-14.3 32-32V208 141.3l73.4 73.4c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3l-128-128zM32 416c-17.7 0-32 14.3-32 32s14.3 32 32 32H352c17.7 0 32-14.3 32-32s-14.3-32-32-32H32z"/></svg>'}}),I([s()],O.prototype,"variant",void 0),I([s()],O.prototype,"accept",void 0),I([s()],O.prototype,"disabled",void 0),I([s()],O.prototype,"value",void 0),I([s()],O.prototype,"selectFileChangeEventEmitter",void 0),I([s()],O.prototype,"vegaFileUploaderValueController",void 0),I([s()],O.prototype,"dropFileFilterController",void 0),I([s()],O.prototype,"translationSlimmer",void 0),I([s()],O.prototype,"fileLimitController",void 0),I([s()],O.prototype,"maxCount",void 0);var U=function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};class A extends n{constructor(){super(...arguments),this.fileRemoveHandler=e=>{this.removeEventEmitter.emit(e).defaultPrevented||this.vegaFileUploaderValueController.setValue(this.value.filter((t=>t!==e)))},this.fileReUploadHandler=e=>{this.retryEventEmitter.emit(e)},this.filePreviewHandler=e=>{this.previewEventEmitter.emit(e)}}render(){const t=!this.value||this.value.length<1;return e("div",{class:{"vega-file-uploader-file-list":!0,"vega-file-list-hidden":t}},!t&&this.value.map((t=>e("vega-box",{key:t.key,class:"vega-file-uploader-file",padding:"size-8",corners:"rounded-8"},e("vega-flex",{alignItems:"start",justifyContent:"space-between"},e("vega-flex",{class:"vega-file-status-and-name",gap:"size-8",alignItems:"start"},e("div",{style:{paddingTop:"3px"}},this.vegaFileUploaderFileStatusRenderer.render(t.status,t.uploadingPercent)),e("vega-flex",{gap:"size-4",direction:"col"},e("vega-font",{color:"done"===t.status||"error"===t.status?"text-primary":"text-secondary",variant:"font-field-label"},t.name),"error"===t.status&&t.errorMessage&&e("vega-font",{color:"text-error",variant:"font-footnote1-short"},t.errorMessage))),e("vega-flex",{gap:"size-4",class:"vega-file-list-buttons",justifyContent:"end"},t.previewable&&e("vega-button-circle",{class:"vega-file-preview-button",variant:"icon-only",size:"small",icon:"zoom-in",iconColor:"text-secondary",label:"Preview",tooltip:{disableInteractive:!0},ref:e=>{f.addUniqueObserverToNode(e,g,(()=>{this.filePreviewHandler(t)}))}}),"error"===t.status&&e("vega-button-circle",{variant:"icon-only",size:"small",icon:p.getIconKey("arrow-rotate-right"),iconColor:"text-secondary",label:"Retry",tooltip:{disableInteractive:!0},disabled:this.disabled,ref:e=>{f.addUniqueObserverToNode(e,g,(()=>{this.fileReUploadHandler(t)}))}}),e("vega-button-circle",{variant:"icon-only",size:"small",icon:p.getIconKey("trash-can"),iconColor:"text-secondary",label:"Delete",tooltip:{disableInteractive:!0},disabled:this.disabled,ref:e=>{f.addUniqueObserverToNode(e,g,(()=>{this.fileRemoveHandler(t)}))}})))))))}}p.register({"trash-can":j,"arrow-rotate-right":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M456 224c13.3 0 24-10.7 24-24V56c0-13.3-10.7-24-24-24s-24 10.7-24 24v80.1l-20-23.5C371 63.4 309.1 32 240 32C116.3 32 16 132.3 16 256s100.3 224 224 224c50.4 0 97-16.7 134.4-44.8c10.6-8 12.7-23 4.8-33.6s-23-12.7-33.6-4.8C316.2 418.9 279.7 432 240 432c-97.2 0-176-78.8-176-176s78.8-176 176-176c54.3 0 102.9 24.6 135.2 63.4l.1 .2 0 0L402.9 176H312c-13.3 0-24 10.7-24 24s10.7 24 24 24H456z"/></svg>'}}),U([s()],A.prototype,"value",void 0),U([s()],A.prototype,"disabled",void 0),U([s()],A.prototype,"vegaFileUploaderFileStatusRenderer",void 0),U([s()],A.prototype,"removeEventEmitter",void 0),U([s()],A.prototype,"vegaFileUploaderValueController",void 0),U([s()],A.prototype,"retryEventEmitter",void 0),U([s()],A.prototype,"previewEventEmitter",void 0);class D extends n{render(t,r){switch(t){case"uploading":return e("vega-loading-indicator",Object.assign({class:"vega-file-list-status",mode:r?"determinate":"indeterminate",size:"micro"},r?{percent:r}:{}));case"done":return e("vega-icon",{class:"vega-file-list-status",color:"text-success",icon:p.getIconKey("circle-check-regular")});case"error":return e("vega-icon",{class:"vega-file-list-status",color:"text-error",icon:p.getIconKey("circle-xmark")});default:return e("vega-loading-indicator",{class:"vega-file-list-status",mode:"determinate",size:"micro"})}}}p.register({"circle-check-regular":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M243.8 339.8C232.9 350.7 215.1 350.7 204.2 339.8L140.2 275.8C129.3 264.9 129.3 247.1 140.2 236.2C151.1 225.3 168.9 225.3 179.8 236.2L224 280.4L332.2 172.2C343.1 161.3 360.9 161.3 371.8 172.2C382.7 183.1 382.7 200.9 371.8 211.8L243.8 339.8zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 48C141.1 48 48 141.1 48 256C48 370.9 141.1 464 256 464C370.9 464 464 370.9 464 256C464 141.1 370.9 48 256 48z"/></svg>'},"circle-xmark":{icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">\x3c!--! Font Awesome Pro 6.3.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2023 Fonticons, Inc. --\x3e<path fill="currentColor" d="M175 175C184.4 165.7 199.6 165.7 208.1 175L255.1 222.1L303 175C312.4 165.7 327.6 165.7 336.1 175C346.3 184.4 346.3 199.6 336.1 208.1L289.9 255.1L336.1 303C346.3 312.4 346.3 327.6 336.1 336.1C327.6 346.3 312.4 346.3 303 336.1L255.1 289.9L208.1 336.1C199.6 346.3 184.4 346.3 175 336.1C165.7 327.6 165.7 312.4 175 303L222.1 255.1L175 208.1C165.7 199.6 165.7 184.4 175 175V175zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 48C141.1 48 48 141.1 48 256C48 370.9 141.1 464 256 464C370.9 464 464 370.9 464 256C464 141.1 370.9 48 256 48z"/></svg>'}});var S=function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};class B extends n{valueChangeHandler(e){!e||Array.isArray(e)?(this.changeEventEmitter.emit(e),R.notify(L,{host:this.host,detail:this.value})):e&&!Array.isArray(e)&&this.setValue(null)}setValue(e){this.value=e}}S([s()],B.prototype,"host",void 0),S([s({writable:!0})],B.prototype,"value",void 0),S([s()],B.prototype,"changeEventEmitter",void 0),S([c("watchValue")],B.prototype,"valueChangeHandler",null);class H extends z{constructor(){super(...arguments),this.checkArrayItemType=e=>!(!e||"object"!=typeof e)}}class N extends n{process(e){const t=Array.from(e||[]);if(e&&this.accept&&"*"!==this.accept&&"/*"!==this.accept){const e=this.accept.split(",");return t.filter((t=>this.validateFileType(t,e)))}return t}validateFileType(e,t){const r=e.name,o=(e.type||"").toLowerCase(),i=o.replace(/\/.*$/,"");return t.some((e=>(e=e.trim().toLowerCase()).startsWith(".")?r.toLowerCase().endsWith(e):e.endsWith("/*")?i===e.replace(/\/.*$/,""):o===e))}}!function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);a>3&&l&&Object.defineProperty(t,r,l)}([s()],N.prototype,"accept",void 0);var P=function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};class q extends n{isSingleMode(){return 1===Number(this.maxCount)}checkMaxCount(){null!==this.maxCount&&this.maxCount<1&&(this.maxCount=null)}}P([s({writable:!0})],q.prototype,"maxCount",void 0),P([c("componentDidLoad"),c("watchMaxCount")],q.prototype,"checkMaxCount",null);var G=function(e,t,r,o){var i,a=arguments.length,l=a<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,r):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)l=Reflect.decorate(e,t,r,o);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(l=(a<3?i(l):a>3?i(t,r,l):i(t,r))||l);return a>3&&l&&Object.defineProperty(t,r,l),l};const T=class{constructor(e){r(this,e),this.vegaChange=o(this,"vegaChange",7),this.change=o(this,"change",7),this.vegaSelectedFileChange=o(this,"vegaSelectedFileChange",7),this.selectedFileChange=o(this,"selectedFileChange",7),this.vegaRemove=o(this,"vegaRemove",7),this.remove=o(this,"remove",7),this.vegaRetry=o(this,"vegaRetry",7),this.retry=o(this,"retry",7),this.vegaPreview=o(this,"vegaPreview",7),this.preview=o(this,"preview",7),this.globalSlimmers={},this.translationSlimmer=new E,this.vegaComponentUsageRuntimeMetricsSlimmer=new v,this.formFieldController=new k({propertyRules:[{propertyName:"required",ruleFactory:e=>e?new H:null}],validationRulesName:"validationRules",defaultValue:[],attributeGetter:e=>this[e],inputContainerGetter:()=>this.vegaFileUploaderContainerRenderer.getUploaderContainerRef(),touchableAreaGetter:()=>[this.vegaFileUploaderContainerRenderer.getUploaderContainerRef()]}),this.vegaFileUploaderRenderer=new V,this.vegaFileUploaderContainerRenderer=new O,this.vegaFileUploaderFileListRenderer=new A,this.vegaFileUploaderFileStatusRenderer=new D,this.vegaFileUploaderValueController=new B,this.dropFileFilterController=new N,this.fileLimitController=new q,this.changeEventEmitter=F(T,u),this.selectFileChangeEventEmitter=F(T,b),this.removeEventEmitter=F(T,m),this.retryEventEmitter=F(T,x),this.previewEventEmitter=F(T,w),this.label="",this.variant="uploadArea",this.hint="",this.value=[],this.disabled=!1,this.maxCount=null,this.required=!1,this.validationRules=[],this.autoValidation=!0,this.isValid=null}watchValue(e){}watchMaxCount(){}watchValidationRules(){}render(){return l(e(i,null,this.vegaFileUploaderRenderer.render()),this.host)}get host(){return a(this)}static get watchers(){return{value:["watchValue"],maxCount:["watchMaxCount"],validationRules:["watchValidationRules"]}}};G([h()],T.prototype,"globalSlimmers",void 0),G([d()],T.prototype,"translationSlimmer",void 0),G([d()],T.prototype,"vegaComponentUsageRuntimeMetricsSlimmer",void 0),G([d()],T.prototype,"formFieldController",void 0),G([d()],T.prototype,"vegaFileUploaderRenderer",void 0),G([d()],T.prototype,"vegaFileUploaderContainerRenderer",void 0),G([d()],T.prototype,"vegaFileUploaderFileListRenderer",void 0),G([d()],T.prototype,"vegaFileUploaderFileStatusRenderer",void 0),G([d()],T.prototype,"vegaFileUploaderValueController",void 0),G([d()],T.prototype,"dropFileFilterController",void 0),G([d()],T.prototype,"fileLimitController",void 0),G([d()],T.prototype,"changeEventEmitter",void 0),G([d()],T.prototype,"selectFileChangeEventEmitter",void 0),G([d()],T.prototype,"removeEventEmitter",void 0),G([d()],T.prototype,"retryEventEmitter",void 0),G([d()],T.prototype,"previewEventEmitter",void 0),T.style=':host{display:inline-block;text-align:left;width:100%;line-height:normal}:host .vega-file-uploader-container .vega-file-upload-area{text-align:center}:host .vega-file-uploader-container .vega-file-upload-area:hover{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border-color:rgba(var(--v-border-color-input-field-hover, 115, 160, 190, 1))}:host .vega-file-uploader-container .vega-file-upload-area:hover vega-icon,:host .vega-file-uploader-container .vega-file-upload-area:hover vega-font{color:rgba(var(--v-text-link-hover, 4, 112, 236, 1))}:host .vega-file-uploader-container .vega-file-upload-area:focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px}:host .vega-file-uploader-container .vega-file-upload-area:active{background-color:rgba(var(--v-bg-secondary, 245, 247, 247, 1));border-color:rgba(var(--v-border-color-action-active, 29, 65, 195, 1))}:host .vega-file-uploader-container .vega-file-upload-area:active vega-icon,:host .vega-file-uploader-container .vega-file-upload-area:active vega-font{color:rgba(var(--v-text-link-active, 29, 65, 195, 1))}:host .vega-file-uploader-container .vega-file-upload-area.disabled{border-color:rgba(var(--v-border-color-input-field-disabled, 222, 225, 227, 1));background-color:rgba(var(--v-bg-tertiary, 240, 243, 247, 1));outline:none}:host .vega-file-uploader-container .vega-file-upload-area.disabled vega-icon,:host .vega-file-uploader-container .vega-file-upload-area.disabled vega-font{color:rgba(var(--v-text-disabled, 176, 180, 181, 1))}:host .vega-file-uploader-container vega-button::part(button):focus-visible{outline:2px solid rgba(var(--v-border-color-action, 19, 98, 226, 1));outline-offset:2px;box-shadow:0 0 0}:host .vega-file-uploader-container.error .vega-file-upload-area{border-color:rgba(var(--v-border-color-input-field-danger, 230, 50, 87, 1))}:host .vega-file-uploader-container.error .vega-file-upload-area:hover{border-color:rgba(var(--v-border-color-input-field-danger-hover, 255, 87, 114, 1))}:host .vega-file-uploader-container.error .vega-file-upload-area:focus-visible{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:2px}:host .vega-file-uploader-container.error .vega-file-upload-area:active{border-color:rgba(var(--v-border-color-input-field-danger-hover, 255, 87, 114, 1))}:host .vega-file-uploader-container.error vega-button::part(button),:host .vega-file-uploader-container.error vega-button::part(button):hover{color:rgba(var(--v-text-danger-link, 230, 50, 87, 1));border-color:rgba(var(--v-border-color-danger, 230, 50, 87, 1))}:host .vega-file-uploader-container.error vega-button::part(button):hover{background-color:rgba(var(--v-bg-danger-tertiary-hover, 255, 87, 114, 0.2));border-color:rgba(var(--v-border-color-danger-hover, 255, 87, 114, 1));color:rgba(var(--v-text-danger-link-hover, 233, 71, 104, 1))}:host .vega-file-uploader-container.error vega-button::part(button):focus-visible{outline:2px solid rgba(var(--v-border-color-danger, 230, 50, 87, 1));outline-offset:2px;box-shadow:0 0 0}:host .vega-file-uploader-container.error vega-button::part(button):active{color:rgba(var(--v-text-danger-link-active, 189, 41, 71, 1));border-color:rgba(var(--v-border-color-danger-active, 189, 41, 71, 1));background-color:rgba(var(--v-bg-danger-tertiary-active, 189, 41, 71, 0.2))}:host .vega-file-uploader-file-list .vega-file-uploader-file .vega-file-preview-button{visibility:hidden}:host .vega-file-uploader-file-list .vega-file-uploader-file:hover{background-color:rgba(var(--v-bg-action-tertiary-hover, 4, 4, 28, 0.05))}:host .vega-file-uploader-file-list .vega-file-uploader-file:hover .vega-file-preview-button{visibility:visible}:host .vega-file-uploader-file-list .vega-file-list-buttons{margin-left:8px;flex-shrink:0}:host .vega-file-uploader-file-list .vega-file-list-status svg{width:16px;height:16px}:host .vega-file-uploader-file-list .vega-file-status-and-name{padding-top:5px}:host .vega-file-uploader-file-list .vega-file-status-and-name vega-font{word-break:break-word}:host vega-field-label{margin-bottom:8px}:host .vega-file-uploader-file-list{margin-top:8px}:host .vega-file-uploader-file-list.vega-file-list-hidden{display:none}:host .vega-error{display:inline-block;padding-left:8px;padding-right:8px;padding-top:8px;font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px;color:rgba(var(--v-text-error, 189, 41, 71, 1))}@media screen and (min-width: 768px) and (max-width: 1023px){:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1024px) and (max-width: 1439px){:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}@media screen and (min-width: 1440px) and (max-width: 9999px){:host .vega-error{font-family:"Inter", sans-serif;font-size:14px;font-weight:400;line-height:18px;letter-spacing:0px}}:host .vega-hidden{display:none}';export{T as vega_file_uploader}
|