@orangelogic/design-system 2.134.0 → 2.136.0
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/library/chunks/asset-link-format.BBWyY5fn.js +2627 -0
- package/library/chunks/{button.DYoFn504.js → button.3giRMk79.js} +2 -2
- package/library/chunks/{checkbox.BzbWmmJ0.js → checkbox.B-2O517F.js} +2 -2
- package/library/chunks/{table.DWcxLbq6.js → color-swatch-group.DC6vIYo4.js} +3133 -2887
- package/library/chunks/{color-swatch.0zyBEfL_.js → color-swatch.g3FPUnxM.js} +2 -2
- package/library/chunks/{confirm-popover.DpVYvK20.js → confirm-popover.DtndPsMa.js} +3 -3
- package/library/chunks/{dialog.BwBD_hJi.js → dialog.BQq3xBeH.js} +2 -2
- package/library/chunks/directive-helpers.DEDMV45_.js +42 -0
- package/library/chunks/{document-viewer.BM716ovi.js → document-viewer.BQPJD2lJ.js} +8 -8
- package/library/chunks/{dom.BXeuEG1b.js → dom.acWb8KCK.js} +1 -1
- package/library/chunks/{dot-pagination.B70lV5Av.js → dot-pagination.DBk9Rz1e.js} +1 -1
- package/library/chunks/{endpoints.6E17hFiK.js → endpoints.tU0_RZ_7.js} +4 -4
- package/library/chunks/{file-on-demand.CsT96fvk.js → file-on-demand.Bnloo9Ui.js} +12 -12
- package/library/chunks/folder-select.DuG4dSPm.js +942 -0
- package/library/chunks/{form.3af0bYrm.js → form.K1XOtu3S.js} +1 -1
- package/library/chunks/{header.BMGvKrdP.js → header.Bpjw08j7.js} +1 -1
- package/library/chunks/{i18n.DoMIwXr2.js → i18n.DJikbkDK.js} +48 -12
- package/library/chunks/{icon-button.B-Jf9W3v.js → icon-button.xobY-9OH.js} +1 -1
- package/library/chunks/{iframe.Cdv6esyS.js → iframe.BkvxcywO.js} +1 -1
- package/library/chunks/{image.SLqIVjqc.js → image.KZRXIthe.js} +241 -229
- package/library/chunks/{input.CQNhMu4z.js → input.GUw7x9tK.js} +3 -3
- package/library/chunks/{keyed.C0rkKrxH.js → keyed.DdOUTIg-.js} +1 -1
- package/library/chunks/{live.SCz6M8Gs.js → live.DCegntDo.js} +1 -1
- package/library/chunks/{option.SCVixE2L.js → option.uHye0aDT.js} +1 -1
- package/library/chunks/{pagination.BFE6Nk3_.js → pagination.D8Hzwlan.js} +6 -6
- package/library/chunks/{ref.bzeTdX0K.js → ref.DktKp7fP.js} +1 -1
- package/library/chunks/{repeat.DbF2p5ae.js → repeat.CFjcER6_.js} +1 -1
- package/library/chunks/{resizable-component.styles.BVhOesNE.js → resizable-component.styles.CAfXABBc.js} +5 -5
- package/library/chunks/{string.CbnVBzsd.js → string.CjJ09HK3.js} +14 -11
- package/library/chunks/{tab-group.C-p2Dljr.js → tab-group.0_aOE22R.js} +5 -5
- package/library/chunks/toast.Bz-j7zP2.js +109 -0
- package/library/chunks/{tree.C2mLhREj.js → tree.C14rLLol.js} +3 -3
- package/library/chunks/url.-WDYqplj.js +42 -0
- package/library/components/alert.js +2 -2
- package/library/components/asset-link-format.js +16 -2163
- package/library/components/atoms.js +49 -51
- package/library/components/audio.js +3 -3
- package/library/components/border-input-group.js +2 -2
- package/library/components/breadcrumb.js +1 -1
- package/library/components/button.js +3 -3
- package/library/components/checkbox.js +3 -3
- package/library/components/color-picker.js +4 -4
- package/library/components/color-swatch-group.js +6 -7
- package/library/components/color-swatch.js +3 -3
- package/library/components/confirm-popover.js +4 -4
- package/library/components/copy-button.js +1 -1
- package/library/components/corner-position-input-group.js +3 -3
- package/library/components/date-calendar.js +2 -2
- package/library/components/details.js +1 -1
- package/library/components/dialog.js +3 -3
- package/library/components/diff.js +1 -1
- package/library/components/document-viewer.js +4 -4
- package/library/components/dot-pagination.js +2 -2
- package/library/components/drawer.js +2 -2
- package/library/components/dropdown.js +2 -2
- package/library/components/dynamic-select.js +88 -85
- package/library/components/e-chart.js +1 -1
- package/library/components/element-clamp.js +2 -2
- package/library/components/file-on-demand.js +13 -13
- package/library/components/folder-select.js +5 -5
- package/library/components/format-bytes.js +1 -1
- package/library/components/format-date.js +1 -1
- package/library/components/format-number.js +1 -1
- package/library/components/format-time.js +1 -1
- package/library/components/header.js +2 -2
- package/library/components/icon-button.js +2 -2
- package/library/components/iframe.js +2 -2
- package/library/components/image-comparer.js +1 -1
- package/library/components/image.js +6 -5
- package/library/components/input.js +4 -4
- package/library/components/line-clamp.js +1 -1
- package/library/components/masonry.js +3 -3
- package/library/components/menu-item.js +2 -2
- package/library/components/menu.js +1 -1
- package/library/components/molecules.js +27 -29
- package/library/components/option.js +2 -2
- package/library/components/organisms.js +6 -6
- package/library/components/padding-input-group.js +2 -2
- package/library/components/pagination.js +7 -7
- package/library/components/popup.js +1 -1
- package/library/components/position-picker.js +1 -1
- package/library/components/progress-bar.js +1 -1
- package/library/components/progress-ring.js +1 -1
- package/library/components/radio-group.js +1 -1
- package/library/components/range.js +5 -5
- package/library/components/rating.js +2 -2
- package/library/components/relative-time.js +1 -1
- package/library/components/select.js +10 -7
- package/library/components/shadow-input-group.js +2 -2
- package/library/components/share-option-list.js +3 -3
- package/library/components/sidebar.js +1 -1
- package/library/components/size-input-group.js +3 -3
- package/library/components/spinner.js +1 -1
- package/library/components/split-panel.js +1 -1
- package/library/components/stepper-wizard.js +1 -1
- package/library/components/switch.js +2 -2
- package/library/components/tab-group.js +5 -5
- package/library/components/tab.js +2 -2
- package/library/components/tag.js +2 -2
- package/library/components/textarea.js +2 -2
- package/library/components/timecode.js +1 -1
- package/library/components/tooltip.js +1 -1
- package/library/components/tree-item.js +4 -4
- package/library/components/tree.js +2 -2
- package/library/components/typeface.js +2 -2
- package/library/components/types.js +46083 -43779
- package/library/components/video.js +3 -3
- package/library/package.json +3 -1
- package/library/packages/atoms/src/components/image/image.d.ts +3 -0
- package/library/packages/atoms/src/components/select/select.d.ts +6 -0
- package/library/packages/atoms/src/components/tab-group/tab-group.d.ts +1 -0
- package/library/packages/atoms/src/index.d.ts +0 -1
- package/library/packages/events/src/cx-folder-select-selection-seeded.d.ts +6 -0
- package/library/packages/events/src/cx-image-src-resolved.d.ts +9 -0
- package/library/packages/events/src/cx-pdf-viewer-annotation-draw-mode-change.d.ts +10 -0
- package/library/packages/events/src/cx-pdf-viewer-annotation-draw-params-change.d.ts +11 -0
- package/library/packages/events/src/cx-pdf-viewer-more-options-select.d.ts +8 -0
- package/library/packages/events/src/cx-pdf-viewer-toolbar-annotation-mode-change.d.ts +10 -0
- package/library/packages/events/src/cx-pdf-viewer-toolbar-annotation-params-change.d.ts +11 -0
- package/library/packages/events/src/cx-pdf-viewer-toolbar-click.d.ts +8 -0
- package/library/packages/events/src/cx-pdf-viewer-toolbar-page-change.d.ts +8 -0
- package/library/packages/events/src/cx-pdf-viewer-toolbar-scale-change.d.ts +8 -0
- package/library/packages/events/src/cx-pdf-viewer-toolbar-view-toggle.d.ts +11 -0
- package/library/packages/events/src/cx-pdf-viewer-view-on-asset-toggle.d.ts +11 -0
- package/library/packages/events/src/cx-video-src-resolved.d.ts +8 -0
- package/library/packages/events/src/events.d.ts +13 -0
- package/library/packages/hybrid/table-core/src/index.d.ts +3 -0
- package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/components/table-row-actions/table-row-actions-dropdown.d.ts +8 -8
- package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/components/table-row-actions/table-row-actions.d.ts +6 -5
- package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/components/table-toolbar/table-dropdown-filter.d.ts +4 -4
- package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/components/table-toolbar/table-group-by-dropdown.d.ts +4 -4
- package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/components/table-toolbar/table-saved-search-dropdown.d.ts +6 -5
- package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/components/table-toolbar/table-toolbar.d.ts +12 -12
- package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/table.d.ts +11 -11
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Clipboard/Clipboard.d.ts +1 -1
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Clipboard/extensions/extensions.d.ts +1 -1
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/History/History.d.ts +1 -1
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/History/extensions/extensions.d.ts +1 -1
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/HoverMenu/HoverMenu.d.ts +1 -1
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/Import/defaults/importers.d.ts +1 -1
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/SelectRange/SelectRange.d.ts +4 -4
- package/library/packages/hybrid/table-core/src/tabulator-tables/modules/SelectRange/extensions/extensions.d.ts +2 -2
- package/library/packages/molecules/src/asset-picker/asset-picker.d.ts +1 -1
- package/library/packages/molecules/src/dynamic-select/dynamic-select.d.ts +5 -0
- package/library/packages/molecules/src/folder-select/components/folder-select-tree-item/folder-select-tree-item.d.ts +32 -0
- package/library/packages/molecules/src/folder-select/folder-select.d.ts +20 -3
- package/library/packages/molecules/src/gallery-item/gallery-item.d.ts +5 -0
- package/library/packages/molecules/src/index.d.ts +1 -1
- package/library/packages/molecules/src/library-index.d.ts +0 -1
- package/library/packages/molecules/src/pdf-viewer-toolbar/components/index.d.ts +3 -0
- package/library/packages/molecules/src/pdf-viewer-toolbar/components/pdf-viewer-annotation-draw/pdf-viewer-annotation-draw.d.ts +92 -0
- package/library/packages/molecules/src/pdf-viewer-toolbar/components/pdf-viewer-more-options/pdf-viewer-more-options.d.ts +43 -0
- package/library/packages/molecules/src/pdf-viewer-toolbar/components/pdf-viewer-more-options/pdf-viewer-more-options.styles.d.ts +2 -0
- package/library/packages/molecules/src/pdf-viewer-toolbar/components/pdf-viewer-view-on-asset/pdf-viewer-view-on-asset.d.ts +42 -0
- package/library/packages/molecules/src/pdf-viewer-toolbar/components/pdf-viewer-view-on-asset/pdf-viewer-view-on-asset.styles.d.ts +2 -0
- package/library/packages/molecules/src/pdf-viewer-toolbar/pdf-viewer-toolbar.d.ts +101 -0
- package/library/packages/molecules/src/pdf-viewer-toolbar/pdf-viewer-toolbar.styles.d.ts +2 -0
- package/library/packages/organisms/src/bento-grid/bento-grid.d.ts +66 -0
- package/library/packages/organisms/src/color-swatch-group/color-swatch-group.constants.d.ts +1 -1
- package/library/packages/organisms/src/color-swatch-group/color-swatch-group.d.ts +1 -1
- package/library/packages/organisms/src/content-builder/components/color-swatch-picker/color-swatch-picker.constants.d.ts +1 -1
- package/library/packages/organisms/src/content-builder/components/color-swatch-picker/color-swatch-picker.d.ts +1 -1
- package/library/packages/organisms/src/content-builder/components/config-form/config-form-controller.d.ts +1 -0
- package/library/packages/organisms/src/content-builder/components/config-form/config-form.d.ts +2 -9
- package/library/packages/organisms/src/content-builder/configs/dam-view.d.ts +1 -7
- package/library/packages/organisms/src/content-builder/configs-controller.d.ts +2 -14
- package/library/packages/organisms/src/content-builder/styleController.d.ts +1 -1
- package/library/packages/organisms/src/dam-custom-toolbar-buttons-editor/dam-custom-toolbar-buttons-editor.d.ts +9 -1
- package/library/packages/organisms/src/dashboard-table/dashboard-table.d.ts +1 -1
- package/library/packages/organisms/src/index.d.ts +1 -0
- package/library/packages/{molecules → organisms}/src/list-editor/list-editor.d.ts +9 -3
- package/library/packages/organisms/src/list-editor/list-editor.styles.d.ts +2 -0
- package/library/packages/organisms/src/video-chapters-manager/video-chapters-manager.d.ts +1 -1
- package/library/packages/services/src/api/folder/folder.types.d.ts +9 -2
- package/library/packages/tools/src/fetch-asset/fetch-asset.d.ts +16 -0
- package/library/packages/types/src/content-builder.d.ts +1 -1
- package/library/packages/types/src/dam-view.d.ts +1 -0
- package/library/packages/types/src/folder-select.d.ts +8 -1
- package/library/packages/types/src/pdf-viewer-toolbar.d.ts +82 -0
- package/library/packages/utils/src/custom-element/i18n.d.ts +43 -7
- package/library/packages/utils/src/string/string.d.ts +1 -1
- package/library/packages/utils/src/url/url.d.ts +12 -2
- package/library/react-web-component.d.ts +1829 -1679
- package/library/utils.js +200 -199
- package/package.json +3 -1
- package/library/chunks/asset.CcxcYY9d.js +0 -469
- package/library/chunks/color-swatch-group.Dx6-kWC-.js +0 -362
- package/library/chunks/directive-helpers.Dm4rc594.js +0 -37
- package/library/chunks/folder-select.DwZ7lczk.js +0 -884
- package/library/chunks/list-editor.BhMNYL8R.js +0 -1394
- package/library/chunks/responsive.Cf65FCWd.js +0 -17
- package/library/chunks/toast.D3AW3RWv.js +0 -94
- package/library/chunks/url.Cj9cIQXJ.js +0 -27
- package/library/components/list-editor.d.ts +0 -3
- package/library/components/list-editor.js +0 -33
- package/library/components/table.d.ts +0 -3
- package/library/components/table.js +0 -84
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/components/index.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/components/table-footer/table-footer.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/components/table-footer/table-footer.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/components/table-row-actions/table-row-actions.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/components/table-toolbar/table-toolbar.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/controllers/ajax-facets/ajax-facet-data-controller.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/controllers/ajax-facets/ajax-facet-filter-controller.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/controllers/filter-controller.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/controllers/select-all-controller.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-alert.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-base.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-calcs.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-clickable-cell.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-data-tree.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-edit.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-footer.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-format.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-group-rows.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-header.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-hover-menu.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-move-rows.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-page.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-placeholder.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-popup.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-print.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-resize.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-responsive-layout.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-rows.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-rtl.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-select-range.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/styles/table-spreadsheet.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/table-data-loader.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/table.styles.d.ts +0 -0
- /package/library/packages/{atoms/src/components → hybrid/table-core/src}/table/table.utils.d.ts +0 -0
- /package/library/packages/molecules/src/{list-editor/list-editor.styles.d.ts → pdf-viewer-toolbar/components/pdf-viewer-annotation-draw/pdf-viewer-annotation-draw.styles.d.ts} +0 -0
|
@@ -0,0 +1,2627 @@
|
|
|
1
|
+
import "../components/cropper.js";
|
|
2
|
+
import { C as G } from "./button.3giRMk79.js";
|
|
3
|
+
import D from "../components/space.js";
|
|
4
|
+
import { C as T } from "./typography.DJC_UXgs.js";
|
|
5
|
+
import { n as h, C as N } from "./lib-cortex-element.CVMmyPMC.js";
|
|
6
|
+
import { h as P, a as Et, C as Tt, S as Nt, b as Lt, c as Ot } from "./endpoints.tU0_RZ_7.js";
|
|
7
|
+
import { M as bt, U as o, T as c } from "./asset-link-format.QzzboHHE.js";
|
|
8
|
+
import "./browser.BHOCIF_A.js";
|
|
9
|
+
import { i as L, x, E as Ut } from "./lit-element.jLBm65_O.js";
|
|
10
|
+
import "./form.K1XOtu3S.js";
|
|
11
|
+
import { L as O } from "./i18n.DJikbkDK.js";
|
|
12
|
+
import { a as qt } from "./string.CjJ09HK3.js";
|
|
13
|
+
import "./date-picker.DTUICGb9.js";
|
|
14
|
+
import "./content-builder.BGzxZUgi.js";
|
|
15
|
+
import "./unsafe-html.Dff7-rCx.js";
|
|
16
|
+
import { b as Bt } from "./_baseUniq.HFKneygy.js";
|
|
17
|
+
import { c as U } from "./component.styles.CRO4Odto.js";
|
|
18
|
+
import { c as q } from "./custom-element.L4WJXn1j.js";
|
|
19
|
+
import { w as C } from "./watch.CThbualB.js";
|
|
20
|
+
import { s as zt, c as At } from "./number.B4PQLJIg.js";
|
|
21
|
+
import { b as et } from "./transformation.c-RS37zA.js";
|
|
22
|
+
import { r as v } from "./state.CSDxrqLd.js";
|
|
23
|
+
import { n as _ } from "./when.Dr1es41R.js";
|
|
24
|
+
import Z from "../components/details.js";
|
|
25
|
+
import jt from "../components/divider.js";
|
|
26
|
+
import { C as Y } from "./icon.DnBh6-56.js";
|
|
27
|
+
import { C as ut } from "./icon-button.xobY-9OH.js";
|
|
28
|
+
import { C as mt } from "./input.GUw7x9tK.js";
|
|
29
|
+
import { C as rt } from "./option.uHye0aDT.js";
|
|
30
|
+
import nt from "../components/select.js";
|
|
31
|
+
import { c as Vt } from "./image.BzmclWBR.js";
|
|
32
|
+
import { e as J } from "./query.BBf1UFkC.js";
|
|
33
|
+
import { c as tt } from "./repeat.CFjcER6_.js";
|
|
34
|
+
import { o as I } from "./style-map.llVFPd__.js";
|
|
35
|
+
import It from "../components/tooltip.js";
|
|
36
|
+
import Gt from "../components/button-group.js";
|
|
37
|
+
import { C as Qt } from "./checkbox.B-2O517F.js";
|
|
38
|
+
function Kt(t) {
|
|
39
|
+
return t && t.length ? Bt(t) : [];
|
|
40
|
+
}
|
|
41
|
+
function Xt(t) {
|
|
42
|
+
return typeof t == "object" && t !== null && "URI" in t;
|
|
43
|
+
}
|
|
44
|
+
const Zt = {
|
|
45
|
+
artist: "Artist",
|
|
46
|
+
color: "Color",
|
|
47
|
+
createDate: "CreateDate",
|
|
48
|
+
directParentFolderIdentifier: "DirectParentFolderIdentifier",
|
|
49
|
+
docSubType: "DocSubType",
|
|
50
|
+
docType: "DocType",
|
|
51
|
+
editDate: "EditDate",
|
|
52
|
+
fileExtension: "Fileextension",
|
|
53
|
+
keyword: "Keyword",
|
|
54
|
+
mediaDate: "MediaDate",
|
|
55
|
+
mediaNumber: "MediaNumber",
|
|
56
|
+
nativeKeyword: "NativeKeyword",
|
|
57
|
+
orientation: "Orientation",
|
|
58
|
+
parentFolderIdentifier: "ParentFolderIdentifier",
|
|
59
|
+
path: "Path",
|
|
60
|
+
photographer: "Photographer",
|
|
61
|
+
purpose: "Purpose",
|
|
62
|
+
recordId: "RecordID",
|
|
63
|
+
systemIdentifier: "SystemIdentifier",
|
|
64
|
+
text: "Text",
|
|
65
|
+
title: "Title"
|
|
66
|
+
}, Yt = /* @__PURE__ */ new Set(["mediaDate", "createDate", "editDate"]);
|
|
67
|
+
function pt(t) {
|
|
68
|
+
return !/[\s&+/*"\\:(),'<>~|[\]{}]/.test(t) && !/^(?:OR|AND|NOT)$/.test(t) ? t : `"${t.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
69
|
+
}
|
|
70
|
+
function wt(t, e) {
|
|
71
|
+
const s = (Array.isArray(e) ? e : [e]).map((a) => `${t}:${pt(a)}`);
|
|
72
|
+
return s.length > 1 ? `(${s.join(" OR ")})` : s[0] ?? "";
|
|
73
|
+
}
|
|
74
|
+
function Jt(t, e) {
|
|
75
|
+
return (Array.isArray(e) ? e : [e]).map((s) => `${t}${s.operator}${s.value}`).join(" AND ");
|
|
76
|
+
}
|
|
77
|
+
function te(t) {
|
|
78
|
+
const e = [];
|
|
79
|
+
for (const i of Object.keys(t)) {
|
|
80
|
+
const s = i, a = t[s];
|
|
81
|
+
if (a == null)
|
|
82
|
+
continue;
|
|
83
|
+
if (s === "custom") {
|
|
84
|
+
for (const [r, l] of Object.entries(
|
|
85
|
+
a
|
|
86
|
+
))
|
|
87
|
+
e.push(wt(r, l));
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
const n = Zt[s];
|
|
91
|
+
if (n) {
|
|
92
|
+
if (Yt.has(s)) {
|
|
93
|
+
e.push(
|
|
94
|
+
Jt(n, a)
|
|
95
|
+
);
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (s === "color") {
|
|
99
|
+
e.push(`${n}:${a}`);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (s === "parentFolderIdentifier") {
|
|
103
|
+
const r = Array.isArray(a) ? a : [a];
|
|
104
|
+
if (r.length === 0)
|
|
105
|
+
continue;
|
|
106
|
+
const l = [
|
|
107
|
+
...r.map((u) => `ParentFolderIdentifier:${pt(String(u))}`),
|
|
108
|
+
...r.map((u) => `ParentAlbumIdentifier:${pt(String(u))}`)
|
|
109
|
+
];
|
|
110
|
+
e.push(`(${l.join(" OR ")})`);
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
e.push(wt(n, a));
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return e.join(" AND ");
|
|
117
|
+
}
|
|
118
|
+
function it(t) {
|
|
119
|
+
if ("and" in t)
|
|
120
|
+
return t.and.map(it).filter(Boolean).join(" AND ");
|
|
121
|
+
if ("or" in t) {
|
|
122
|
+
const e = t.or.map(it).filter(Boolean);
|
|
123
|
+
return e.length > 1 ? `(${e.join(" OR ")})` : e[0] ?? "";
|
|
124
|
+
}
|
|
125
|
+
if ("not" in t) {
|
|
126
|
+
const e = it(t.not);
|
|
127
|
+
return e ? `NOT (${e})` : "";
|
|
128
|
+
}
|
|
129
|
+
return te(t);
|
|
130
|
+
}
|
|
131
|
+
const dt = "CoreField.LargeSizePreview", vt = "CoreField.DocType", ee = "Document.Title", ie = "Document.CaptionLong", kt = "Document.FileExtension", Ct = "CoreField.FileSize", $t = "CoreField.Identifier", Rt = "CoreField.Keywords", _t = "CoreField.MaxHeight", Pt = "CoreField.MaxWidth", st = "Document.RecordID", Mt = "CoreField.DocSubType", Ht = "CoreField.TitleWithFallback", at = "CoreField.OriginalFileName", ot = "CoreField.UpdatedFileName", X = "CoreField.OriginalPreview", ct = {
|
|
132
|
+
DEFAULT_VIEW_SIZE: "Document.LargeSizePreview",
|
|
133
|
+
FIELD_TITLE_WITH_FALLBACK: "Document.TitleWithFallback",
|
|
134
|
+
ORIGINAL_VIEW_SIZE: "Document.OriginalPreview"
|
|
135
|
+
}, Wt = {
|
|
136
|
+
[dt]: ct.DEFAULT_VIEW_SIZE,
|
|
137
|
+
[Ht]: ct.FIELD_TITLE_WITH_FALLBACK,
|
|
138
|
+
[X]: ct.ORIGINAL_VIEW_SIZE
|
|
139
|
+
}, se = Object.fromEntries(
|
|
140
|
+
Object.entries(Wt).map(([t, e]) => [
|
|
141
|
+
e,
|
|
142
|
+
t
|
|
143
|
+
])
|
|
144
|
+
);
|
|
145
|
+
function ae(t) {
|
|
146
|
+
return Wt[t] ?? t;
|
|
147
|
+
}
|
|
148
|
+
function Ft(t) {
|
|
149
|
+
const e = {};
|
|
150
|
+
for (const [i, s] of Object.entries(t)) {
|
|
151
|
+
const a = se[i] ?? i;
|
|
152
|
+
e[a] = s;
|
|
153
|
+
}
|
|
154
|
+
return e;
|
|
155
|
+
}
|
|
156
|
+
async function Dt({
|
|
157
|
+
countPerPage: t,
|
|
158
|
+
fields: e,
|
|
159
|
+
getPermanentAssetsPaths: i,
|
|
160
|
+
isSiteBuilder: s,
|
|
161
|
+
pageNumber: a,
|
|
162
|
+
query: n,
|
|
163
|
+
securityByPassToken: r,
|
|
164
|
+
siteUrl: l,
|
|
165
|
+
sort: u,
|
|
166
|
+
token: S,
|
|
167
|
+
useSession: f
|
|
168
|
+
}) {
|
|
169
|
+
const A = e?.map(ae);
|
|
170
|
+
try {
|
|
171
|
+
return (await P.request({
|
|
172
|
+
baseURL: l,
|
|
173
|
+
headers: S ? { Authorization: `Bearer ${S}` } : void 0,
|
|
174
|
+
method: "GET",
|
|
175
|
+
params: {
|
|
176
|
+
CountPerPage: t,
|
|
177
|
+
Fields: Kt(A),
|
|
178
|
+
Format: "json",
|
|
179
|
+
GetPermanentAssetsPaths: i || void 0,
|
|
180
|
+
PageNumber: a,
|
|
181
|
+
Query: it(n),
|
|
182
|
+
SecurityByPassToken: r || void 0,
|
|
183
|
+
Sort: u || void 0,
|
|
184
|
+
UseSession: f || void 0
|
|
185
|
+
},
|
|
186
|
+
paramsSerializer: { indexes: null },
|
|
187
|
+
responseType: "json",
|
|
188
|
+
transformResponse: [
|
|
189
|
+
...Array.isArray(P.defaults.transformResponse) ? P.defaults.transformResponse : [],
|
|
190
|
+
s ? (m) => ({
|
|
191
|
+
items: (m.results?.Items ?? []).map(Ft),
|
|
192
|
+
sort: m.results?.GlobalInfo?.Sort ?? "",
|
|
193
|
+
totalCount: m.results?.GlobalInfo?.TotalCount ?? 0
|
|
194
|
+
}) : (m) => ({
|
|
195
|
+
items: (m.APIResponse?.Items ?? []).map(Ft),
|
|
196
|
+
sort: m.APIResponse?.GlobalInfo?.Sort ?? "",
|
|
197
|
+
totalCount: m.APIResponse?.GlobalInfo?.TotalCount ?? 0
|
|
198
|
+
})
|
|
199
|
+
],
|
|
200
|
+
url: s ? Tt.SEARCH_ASSETS : Nt["4.0"]
|
|
201
|
+
})).data;
|
|
202
|
+
} catch {
|
|
203
|
+
return { items: [], sort: "", totalCount: 0 };
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
async function oe({
|
|
207
|
+
assetId: t,
|
|
208
|
+
extension: e,
|
|
209
|
+
format: i,
|
|
210
|
+
siteUrl: s,
|
|
211
|
+
token: a,
|
|
212
|
+
transformations: n,
|
|
213
|
+
useSession: r
|
|
214
|
+
}) {
|
|
215
|
+
try {
|
|
216
|
+
return (await P.request({
|
|
217
|
+
baseURL: s,
|
|
218
|
+
method: "GET",
|
|
219
|
+
params: {
|
|
220
|
+
SourceAssetFormat: i,
|
|
221
|
+
SourceAssetRecordID: t,
|
|
222
|
+
TargetExtension: qt(e),
|
|
223
|
+
Token: a || void 0,
|
|
224
|
+
Transformations: n,
|
|
225
|
+
UseSession: r || void 0
|
|
226
|
+
},
|
|
227
|
+
/**
|
|
228
|
+
* https://link.orangelogic.com/Tasks/41S1XH
|
|
229
|
+
*/
|
|
230
|
+
timeout: 3e5,
|
|
231
|
+
// 5 minutes
|
|
232
|
+
url: Et.GET_TRANSFORM_ASSET_LINK
|
|
233
|
+
})).data;
|
|
234
|
+
} catch {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
const re = 50;
|
|
239
|
+
function ne(t, e) {
|
|
240
|
+
const i = [];
|
|
241
|
+
for (let s = 0; s < t.length; s += e)
|
|
242
|
+
i.push(t.slice(s, s + e));
|
|
243
|
+
return i;
|
|
244
|
+
}
|
|
245
|
+
async function gi({
|
|
246
|
+
extraFields: t,
|
|
247
|
+
getPermanentAssetsPaths: e,
|
|
248
|
+
isSiteBuilder: i,
|
|
249
|
+
recordIds: s,
|
|
250
|
+
securityByPassToken: a,
|
|
251
|
+
token: n
|
|
252
|
+
}) {
|
|
253
|
+
if (!Array.isArray(s) || s.length === 0)
|
|
254
|
+
return { facets: [], items: [], totalCount: 0 };
|
|
255
|
+
const r = t?.filter((m) => m && typeof m == "string") ?? [], l = [
|
|
256
|
+
...r,
|
|
257
|
+
X,
|
|
258
|
+
ot,
|
|
259
|
+
at,
|
|
260
|
+
ee,
|
|
261
|
+
ie,
|
|
262
|
+
st
|
|
263
|
+
], u = ne(s, re), S = await Promise.all(
|
|
264
|
+
u.map(
|
|
265
|
+
(m) => Dt({
|
|
266
|
+
countPerPage: m.length,
|
|
267
|
+
fields: l,
|
|
268
|
+
getPermanentAssetsPaths: e,
|
|
269
|
+
isSiteBuilder: i,
|
|
270
|
+
pageNumber: 1,
|
|
271
|
+
query: { recordId: m },
|
|
272
|
+
securityByPassToken: a,
|
|
273
|
+
token: n
|
|
274
|
+
})
|
|
275
|
+
)
|
|
276
|
+
), f = new Map(s.map((m, R) => [m, R])), A = S.flatMap((m) => m.items).map((m) => {
|
|
277
|
+
let R = w(m, ot);
|
|
278
|
+
return R === "" && (R = w(m, at)), {
|
|
279
|
+
name: R,
|
|
280
|
+
originalUrl: w(m, X),
|
|
281
|
+
recordId: w(m, st),
|
|
282
|
+
...r.reduce(
|
|
283
|
+
(Q, b) => (Q[b] = w(m, b), Q),
|
|
284
|
+
{}
|
|
285
|
+
)
|
|
286
|
+
};
|
|
287
|
+
}).sort(
|
|
288
|
+
(m, R) => (f.get(m.recordId) ?? 1 / 0) - (f.get(R.recordId) ?? 1 / 0)
|
|
289
|
+
), $ = S.reduce(
|
|
290
|
+
(m, R) => m + R.totalCount,
|
|
291
|
+
0
|
|
292
|
+
);
|
|
293
|
+
return { facets: [], items: A, totalCount: $ };
|
|
294
|
+
}
|
|
295
|
+
function w(t, e) {
|
|
296
|
+
const i = t[e];
|
|
297
|
+
return i == null ? "" : typeof i == "string" ? i : typeof i == "number" || typeof i == "boolean" ? String(i) : Xt(i) ? i.URI : "";
|
|
298
|
+
}
|
|
299
|
+
async function xi({
|
|
300
|
+
countPerPage: t,
|
|
301
|
+
directParentFolderIdentifier: e,
|
|
302
|
+
extraFields: i,
|
|
303
|
+
getPermanentAssetsPaths: s,
|
|
304
|
+
isSiteBuilder: a,
|
|
305
|
+
limitedDocTypes: n,
|
|
306
|
+
pageNumber: r,
|
|
307
|
+
parentFolderIdentifier: l,
|
|
308
|
+
searchTerm: u,
|
|
309
|
+
securityByPassToken: S,
|
|
310
|
+
sortOrder: f,
|
|
311
|
+
token: A
|
|
312
|
+
}) {
|
|
313
|
+
if (!e && !l)
|
|
314
|
+
return { facets: [], items: [], totalCount: 0 };
|
|
315
|
+
const $ = (i?.filter((b) => b && typeof b == "string") ?? []).map((b) => b.replace("%20", " ")), m = {
|
|
316
|
+
directParentFolderIdentifier: e,
|
|
317
|
+
parentFolderIdentifier: l,
|
|
318
|
+
...n.length > 0 ? { docType: [bt.Image, bt.Audio] } : {}
|
|
319
|
+
}, R = await Dt({
|
|
320
|
+
countPerPage: t,
|
|
321
|
+
fields: [
|
|
322
|
+
...$,
|
|
323
|
+
Ht,
|
|
324
|
+
dt,
|
|
325
|
+
X,
|
|
326
|
+
Rt,
|
|
327
|
+
Pt,
|
|
328
|
+
_t,
|
|
329
|
+
Ct,
|
|
330
|
+
vt,
|
|
331
|
+
Mt,
|
|
332
|
+
$t,
|
|
333
|
+
kt,
|
|
334
|
+
st,
|
|
335
|
+
at,
|
|
336
|
+
ot
|
|
337
|
+
],
|
|
338
|
+
getPermanentAssetsPaths: s,
|
|
339
|
+
isSiteBuilder: a,
|
|
340
|
+
pageNumber: r,
|
|
341
|
+
query: m,
|
|
342
|
+
securityByPassToken: S,
|
|
343
|
+
sort: void 0,
|
|
344
|
+
token: A
|
|
345
|
+
}), Q = R.items.map((b) => {
|
|
346
|
+
let K = w(b, kt), lt = w(b, ot), gt = w(b, dt);
|
|
347
|
+
K && !K.startsWith(".") && (K = "." + K), lt === "" && (lt = w(b, at)), K.toLowerCase() === ".gif" && (gt = w(b, X));
|
|
348
|
+
const xt = w(b, st);
|
|
349
|
+
return {
|
|
350
|
+
docSubType: w(b, Mt),
|
|
351
|
+
docType: w(b, vt) || "",
|
|
352
|
+
extension: K,
|
|
353
|
+
height: w(b, _t) || "0",
|
|
354
|
+
id: xt,
|
|
355
|
+
identifier: w(b, $t),
|
|
356
|
+
imageUrl: gt,
|
|
357
|
+
name: lt,
|
|
358
|
+
originalUrl: w(b, X),
|
|
359
|
+
recordId: xt,
|
|
360
|
+
size: w(b, Ct) || "0 MB",
|
|
361
|
+
tags: w(b, Rt),
|
|
362
|
+
width: w(b, Pt) || "0",
|
|
363
|
+
...$.reduce(
|
|
364
|
+
(yt, St) => (yt[St] = w(b, St), yt),
|
|
365
|
+
{}
|
|
366
|
+
)
|
|
367
|
+
};
|
|
368
|
+
});
|
|
369
|
+
return {
|
|
370
|
+
facets: [],
|
|
371
|
+
items: Q,
|
|
372
|
+
totalCount: R.totalCount
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
async function he({
|
|
376
|
+
autoCropMode: t,
|
|
377
|
+
cropHeight: e,
|
|
378
|
+
cropWidth: i,
|
|
379
|
+
imageUrl: s,
|
|
380
|
+
useSession: a
|
|
381
|
+
}) {
|
|
382
|
+
try {
|
|
383
|
+
return (await P.request({
|
|
384
|
+
method: "GET",
|
|
385
|
+
params: {
|
|
386
|
+
AutoCropMode: t,
|
|
387
|
+
CropHeight: e,
|
|
388
|
+
CropWidth: i,
|
|
389
|
+
ImageUrl: s && new URL(s, window.location.origin).href,
|
|
390
|
+
UseSession: a || void 0
|
|
391
|
+
},
|
|
392
|
+
responseType: "json",
|
|
393
|
+
timeout: 3e5,
|
|
394
|
+
// 5 minutes
|
|
395
|
+
transformResponse: [
|
|
396
|
+
...Array.isArray(P.defaults.transformResponse) ? P.defaults.transformResponse : [],
|
|
397
|
+
(r) => ({
|
|
398
|
+
height: r.cropHeight,
|
|
399
|
+
width: r.cropWidth,
|
|
400
|
+
x: r.cropX,
|
|
401
|
+
y: r.cropY
|
|
402
|
+
})
|
|
403
|
+
],
|
|
404
|
+
url: Et.GET_CROP_ZONE_SUGGESTION
|
|
405
|
+
})).data;
|
|
406
|
+
} catch {
|
|
407
|
+
return null;
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
async function yi({
|
|
411
|
+
assetRecordId: t,
|
|
412
|
+
siteUrl: e,
|
|
413
|
+
token: i,
|
|
414
|
+
useSession: s
|
|
415
|
+
}) {
|
|
416
|
+
try {
|
|
417
|
+
return (await P.request({
|
|
418
|
+
baseURL: e,
|
|
419
|
+
method: "GET",
|
|
420
|
+
params: {
|
|
421
|
+
RecordId: t,
|
|
422
|
+
Token: i,
|
|
423
|
+
UseSession: s || void 0
|
|
424
|
+
},
|
|
425
|
+
responseType: "json",
|
|
426
|
+
transformResponse: [
|
|
427
|
+
...Array.isArray(P.defaults.transformResponse) ? P.defaults.transformResponse : [],
|
|
428
|
+
(n) => !n || typeof n != "object" ? [] : n.proxies?.map((r) => ({
|
|
429
|
+
cdnName: r.cdnName,
|
|
430
|
+
extension: r.extension,
|
|
431
|
+
formatHeight: r.formatHeight,
|
|
432
|
+
formatWidth: r.formatWidth,
|
|
433
|
+
height: r.height,
|
|
434
|
+
permanentLink: r.permanentLink,
|
|
435
|
+
proxyLabel: r.proxyLabel,
|
|
436
|
+
proxyName: r.proxyName,
|
|
437
|
+
width: r.width
|
|
438
|
+
})) ?? []
|
|
439
|
+
],
|
|
440
|
+
url: Ot
|
|
441
|
+
})).data;
|
|
442
|
+
} catch {
|
|
443
|
+
return [];
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
async function Si({
|
|
447
|
+
siteUrl: t
|
|
448
|
+
} = {}) {
|
|
449
|
+
try {
|
|
450
|
+
return (await P.request({
|
|
451
|
+
baseURL: t,
|
|
452
|
+
method: "GET",
|
|
453
|
+
responseType: "json",
|
|
454
|
+
transformResponse: [
|
|
455
|
+
...Array.isArray(P.defaults.transformResponse) ? P.defaults.transformResponse : [],
|
|
456
|
+
(i) => !i || typeof i != "object" ? {
|
|
457
|
+
formatsByDocType: {
|
|
458
|
+
Audio: {},
|
|
459
|
+
Image: {},
|
|
460
|
+
Multimedia: {},
|
|
461
|
+
Video: {}
|
|
462
|
+
}
|
|
463
|
+
} : {
|
|
464
|
+
formatsByDocType: i.formatsByDocType ?? {}
|
|
465
|
+
}
|
|
466
|
+
],
|
|
467
|
+
url: Lt
|
|
468
|
+
})).data;
|
|
469
|
+
} catch {
|
|
470
|
+
return { formatsByDocType: {} };
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
const le = L`.asset-link-format__details{--header-padding:var(--cx-spacing-small) var(--cx-spacing-medium)}.asset-link-format__details::part(icon){width:var(--cx-font-size-3x-large);height:var(--cx-font-size-3x-large);background-color:var(--cx-color-neutral-100);border-radius:var(--cx-border-radius-large);color:var(--cx-color-neutral-600);font-size:var(--cx-font-size-large);justify-content:center;align-items:center;display:flex}.asset-link-format__details::part(input-label){color:var(--cx-color-neutral-400);margin-inline-start:var(--cx-spacing-small)}.asset-link-format__header{padding:var(--cx-spacing-medium)}.asset-link-format__section-header{padding:0 var(--cx-spacing-medium);border-top:var(--section-header-border-width,1px) solid var(--cx-color-neutral-200);background-color:var(--cx-color-neutral-50)}.asset-link-format__undo,.asset-link-format__reset{--color:var(--cx-color-primary);--background-color:transparent}`, ce = L`cx-details::part(base){border-bottom-width:0}cx-space{width:100%}cx-space cx-input{flex:1}.crop__unit-select{width:120px}.crop__input-group{flex:1;display:flex}`;
|
|
474
|
+
var pe = Object.defineProperty, de = Object.getOwnPropertyDescriptor, y = (t, e, i, s) => {
|
|
475
|
+
for (var a = s > 1 ? void 0 : s ? de(e, i) : e, n = t.length - 1, r; n >= 0; n--)
|
|
476
|
+
(r = t[n]) && (a = (s ? r(e, i, a) : r(a)) || a);
|
|
477
|
+
return s && a && pe(e, i, a), a;
|
|
478
|
+
};
|
|
479
|
+
let g = class extends N {
|
|
480
|
+
constructor() {
|
|
481
|
+
super(...arguments), this.localize = new O(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.percentageWidth = 0, this.percentageHeight = 0, this.unit = o.Pixel, this.disabledApply = !1, this.canApply = !1, this.lastAppliedSetting = {
|
|
482
|
+
[o.Pixel]: {
|
|
483
|
+
height: 0,
|
|
484
|
+
percentageHeight: 100,
|
|
485
|
+
percentageWidth: 100,
|
|
486
|
+
unit: o.Pixel,
|
|
487
|
+
width: 0,
|
|
488
|
+
x: 0,
|
|
489
|
+
y: 0
|
|
490
|
+
},
|
|
491
|
+
[o.AspectRatio]: {
|
|
492
|
+
height: 1,
|
|
493
|
+
percentageHeight: 100,
|
|
494
|
+
percentageWidth: 100,
|
|
495
|
+
unit: o.AspectRatio,
|
|
496
|
+
width: 1,
|
|
497
|
+
x: 0,
|
|
498
|
+
y: 0
|
|
499
|
+
}
|
|
500
|
+
}, this.loading = !1, this.cropModes = [], this.focusModes = [], this.focusMode = "manual", this.cropMode = "free", this.keepAspectRatio = !1, this.invalidWidth = !1, this.invalidHeight = !1, this.aspectRatio = 0;
|
|
501
|
+
}
|
|
502
|
+
get selectedMode() {
|
|
503
|
+
return this.cropModes.find((t) => t.value === this.cropMode);
|
|
504
|
+
}
|
|
505
|
+
async handleCropModeChange() {
|
|
506
|
+
if (typeof this.cropMode == "string" && /^\d+:\d+$/.test(this.cropMode)) {
|
|
507
|
+
const [t, e] = this.cropMode.split(":").map(Number);
|
|
508
|
+
this.aspectRatio = t / e;
|
|
509
|
+
return;
|
|
510
|
+
}
|
|
511
|
+
if (this.keepAspectRatio) {
|
|
512
|
+
if (this.unit === o.Pixel && this.width && this.height) {
|
|
513
|
+
this.aspectRatio = this.width / this.height;
|
|
514
|
+
return;
|
|
515
|
+
} else if (this.unit === o.AspectRatio && this.ratioWidth && this.ratioHeight) {
|
|
516
|
+
this.aspectRatio = this.ratioWidth / this.ratioHeight;
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
if (this.maxWidth && this.maxHeight && Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight)) {
|
|
521
|
+
this.aspectRatio = this.maxWidth / this.maxHeight;
|
|
522
|
+
return;
|
|
523
|
+
}
|
|
524
|
+
this.aspectRatio = 1;
|
|
525
|
+
}
|
|
526
|
+
async handleOpenChange() {
|
|
527
|
+
if (this.cropMode = "free", await this.updateComplete, !this.open) {
|
|
528
|
+
if (!this.canApply)
|
|
529
|
+
return;
|
|
530
|
+
this.width = this.lastAppliedSetting[o.Pixel].width, this.height = this.lastAppliedSetting[o.Pixel].height, this.unit = o.Pixel, this.emit("cx-asset-link-format-crop-change", {
|
|
531
|
+
detail: {
|
|
532
|
+
height: this.lastAppliedSetting[o.Pixel].height,
|
|
533
|
+
keepAspectRatio: this.keepAspectRatio,
|
|
534
|
+
unit: o.Pixel,
|
|
535
|
+
width: this.lastAppliedSetting[o.Pixel].width
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
handleWidthChange(t) {
|
|
541
|
+
if (!t.target.value) {
|
|
542
|
+
this.invalidWidth = !0;
|
|
543
|
+
return;
|
|
544
|
+
}
|
|
545
|
+
this.invalidWidth = !1;
|
|
546
|
+
let e = Number(t.target.value);
|
|
547
|
+
this.unit === o.Pixel && (e = Math.max(Math.min(e, this.maxWidth), 1)), t.target.value = e.toString();
|
|
548
|
+
let i = this.unit === o.Pixel ? this.height : this.ratioHeight, s = !1;
|
|
549
|
+
this.keepAspectRatio && (i = Math.round(e / this.aspectRatio), this.unit === o.Pixel && i > this.maxHeight && (i = this.maxHeight, s = !0)), this.invalidHeight = !1, this.emit("cx-asset-link-format-crop-change", {
|
|
550
|
+
detail: {
|
|
551
|
+
breakAspectRatio: s,
|
|
552
|
+
height: i,
|
|
553
|
+
keepAspectRatio: this.keepAspectRatio,
|
|
554
|
+
unit: this.unit,
|
|
555
|
+
width: e
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
}
|
|
559
|
+
handleHeightChange(t) {
|
|
560
|
+
if (!t.target.value) {
|
|
561
|
+
this.invalidHeight = !0;
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
this.invalidHeight = !1;
|
|
565
|
+
let e = Number(t.target.value);
|
|
566
|
+
this.unit === o.Pixel && (e = Math.max(Math.min(e, this.maxHeight), 1)), t.target.value = e.toString();
|
|
567
|
+
let i = this.unit === o.Pixel ? this.width : this.ratioWidth, s = !1;
|
|
568
|
+
this.keepAspectRatio && (i = Math.round(e * this.aspectRatio), this.unit === o.Pixel && i > this.maxWidth && (i = this.maxWidth, s = !0)), this.invalidWidth = !1, this.emit("cx-asset-link-format-crop-change", {
|
|
569
|
+
detail: {
|
|
570
|
+
breakAspectRatio: s,
|
|
571
|
+
height: e,
|
|
572
|
+
keepAspectRatio: this.keepAspectRatio,
|
|
573
|
+
unit: this.unit,
|
|
574
|
+
width: i
|
|
575
|
+
}
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
onCropModeChange(t) {
|
|
579
|
+
const e = t.target.value, i = this.cropModes.find((s) => s.value === e)?.auto;
|
|
580
|
+
if (e === "free")
|
|
581
|
+
this.selectedMode?.auto && this.emit("cx-asset-link-format-crop-change", {
|
|
582
|
+
detail: {
|
|
583
|
+
height: this.lastAppliedSetting[o.Pixel].height,
|
|
584
|
+
keepAspectRatio: !1,
|
|
585
|
+
silent: !0,
|
|
586
|
+
unit: o.Pixel,
|
|
587
|
+
width: this.lastAppliedSetting[o.Pixel].width
|
|
588
|
+
}
|
|
589
|
+
});
|
|
590
|
+
else if (!i) {
|
|
591
|
+
const [s, a] = e.split(":").map(Number);
|
|
592
|
+
if (this.unit === o.Pixel) {
|
|
593
|
+
let n = s, r = a;
|
|
594
|
+
Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight) && ({ height: r, width: n } = Vt(
|
|
595
|
+
this.maxWidth,
|
|
596
|
+
this.maxHeight,
|
|
597
|
+
s,
|
|
598
|
+
a
|
|
599
|
+
)), this.emit("cx-asset-link-format-crop-change", {
|
|
600
|
+
detail: {
|
|
601
|
+
height: r,
|
|
602
|
+
keepAspectRatio: !0,
|
|
603
|
+
silent: !0,
|
|
604
|
+
unit: o.Pixel,
|
|
605
|
+
width: n
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
} else
|
|
609
|
+
this.emit("cx-asset-link-format-crop-change", {
|
|
610
|
+
detail: {
|
|
611
|
+
height: a,
|
|
612
|
+
keepAspectRatio: !0,
|
|
613
|
+
silent: !0,
|
|
614
|
+
unit: o.AspectRatio,
|
|
615
|
+
width: s
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
this.emit("cx-asset-link-format-crop-mode-change", {
|
|
620
|
+
detail: {
|
|
621
|
+
mode: e
|
|
622
|
+
}
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
onFocusModeChange(t) {
|
|
626
|
+
const e = t.target.value;
|
|
627
|
+
this.emit("cx-asset-link-format-crop-focus-mode-change", {
|
|
628
|
+
detail: {
|
|
629
|
+
mode: e
|
|
630
|
+
}
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Handles the change of the unit of measurement for the crop settings.
|
|
635
|
+
* When the unit is changed to Aspect Ratio, it emits an event with the last applied settings for Aspect Ratio.
|
|
636
|
+
* When the unit is changed to Pixels, it emits an event with the last applied settings for Pixels.
|
|
637
|
+
* This allows the parent component to update the crop settings accordingly.
|
|
638
|
+
*/
|
|
639
|
+
onUnitChange(t) {
|
|
640
|
+
t.target.value === o.AspectRatio ? this.emit("cx-asset-link-format-crop-change", {
|
|
641
|
+
detail: {
|
|
642
|
+
height: this.lastAppliedSetting[o.AspectRatio].height,
|
|
643
|
+
keepAspectRatio: this.keepAspectRatio,
|
|
644
|
+
unit: o.AspectRatio,
|
|
645
|
+
width: this.lastAppliedSetting[o.AspectRatio].width
|
|
646
|
+
}
|
|
647
|
+
}) : this.emit("cx-asset-link-format-crop-change", {
|
|
648
|
+
detail: {
|
|
649
|
+
height: this.lastAppliedSetting[o.Pixel].height,
|
|
650
|
+
keepAspectRatio: this.keepAspectRatio,
|
|
651
|
+
unit: o.Pixel,
|
|
652
|
+
width: this.lastAppliedSetting[o.Pixel].width
|
|
653
|
+
}
|
|
654
|
+
}), this.emit("cx-asset-link-format-crop-mode-change", {
|
|
655
|
+
detail: {
|
|
656
|
+
mode: "free"
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
}
|
|
660
|
+
handleInputChange(t) {
|
|
661
|
+
t.stopPropagation(), this.emit("cx-asset-link-format-crop-changed");
|
|
662
|
+
}
|
|
663
|
+
handleApply() {
|
|
664
|
+
this.loading || this.emit("cx-asset-link-format-crop-apply", {
|
|
665
|
+
detail: {
|
|
666
|
+
height: this.height,
|
|
667
|
+
unit: this.unit,
|
|
668
|
+
width: this.width
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Handles showing the details section.
|
|
674
|
+
* This method prevents the event from propagating if the target is not the base element, such as tooltips, select dropdowns, or other interactive elements inside the details.
|
|
675
|
+
* This ensures that the details section is only shown when the user interacts with the base element.
|
|
676
|
+
*/
|
|
677
|
+
onShowDetails(t) {
|
|
678
|
+
t.target !== this.base && t.stopPropagation();
|
|
679
|
+
}
|
|
680
|
+
/**
|
|
681
|
+
* Handles hiding the details section.
|
|
682
|
+
* This method prevents the event from propagating if the target is not the base element, such as tooltips, select dropdowns, or other interactive elements inside the details.
|
|
683
|
+
* This ensures that the details section is only hidden when the user interacts with the base element.
|
|
684
|
+
*/
|
|
685
|
+
onHideDetails(t) {
|
|
686
|
+
t.target !== this.base && t.stopPropagation();
|
|
687
|
+
}
|
|
688
|
+
handleAspectRatioClick() {
|
|
689
|
+
this.keepAspectRatio && this.cropMode !== "free" && this.emit("cx-asset-link-format-crop-mode-change", {
|
|
690
|
+
detail: {
|
|
691
|
+
mode: "free"
|
|
692
|
+
}
|
|
693
|
+
}), this.emit("cx-asset-link-format-crop-change", {
|
|
694
|
+
detail: {
|
|
695
|
+
height: this.unit === o.Pixel ? this.height : this.ratioHeight,
|
|
696
|
+
keepAspectRatio: !this.keepAspectRatio,
|
|
697
|
+
unit: this.unit,
|
|
698
|
+
width: this.unit === o.Pixel ? this.width : this.ratioWidth
|
|
699
|
+
}
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
render() {
|
|
703
|
+
const t = this.cropModes.filter((i) => !i.auto), e = this.cropModes.filter((i) => i.auto);
|
|
704
|
+
return x`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="crop"></cx-icon></div><cx-typography variant="body2">${this.localize.term("crop")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small"><cx-select data-testid="cx-asset-link-format-crop-mode" value=${this.cropMode} hoist style=${I({
|
|
705
|
+
width: "100%"
|
|
706
|
+
})} @cx-change=${this.onCropModeChange} ?disabled=${this.loading}>${tt(
|
|
707
|
+
t,
|
|
708
|
+
(i) => i.value,
|
|
709
|
+
({ label: i, value: s }) => x`<cx-option value=${s}>${i}</cx-option>`
|
|
710
|
+
)}
|
|
711
|
+
${_(
|
|
712
|
+
e.length > 0,
|
|
713
|
+
() => x`<cx-divider></cx-divider><small>${this.localize.term("autoCropping")}</small>`
|
|
714
|
+
)}
|
|
715
|
+
${tt(
|
|
716
|
+
e,
|
|
717
|
+
(i) => i.value,
|
|
718
|
+
({ label: i, value: s }) => x`<cx-option value=${s}>${i}</cx-option>`
|
|
719
|
+
)}</cx-select><cx-space spacing="small"><div class="crop__input-group"><cx-input data-testid="cx-asset-link-format-crop-width" placeholder=${this.localize.term("width")} mask="num" .maskBlocks=${{ num: { mask: Number, min: 1 } }} value=${this.unit === o.Pixel ? this.width.toString() : this.ratioWidth.toString()} @cx-change=${this.handleInputChange} @cx-input=${this.handleWidthChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
720
|
+
W
|
|
721
|
+
</cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-crop-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} @click=${this.handleAspectRatioClick} style=${I({
|
|
722
|
+
color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0
|
|
723
|
+
})} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-crop-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${{ num: { mask: Number, min: 1 } }} value=${this.unit === o.Pixel ? this.height.toString() : this.ratioHeight.toString()} ?disabled=${this.loading} @cx-change=${this.handleInputChange} @cx-input=${this.handleHeightChange} required><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
724
|
+
H
|
|
725
|
+
</cx-typography></cx-input></div><cx-select data-testid="cx-asset-link-format-crop-unit" value=${this.unit} hoist class="crop__unit-select" ?disabled=${this.loading} @cx-change=${this.onUnitChange}><cx-option value=${o.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${o.AspectRatio}>${this.localize.term("aspectRatio")}</cx-option></cx-select></cx-space>${_(
|
|
726
|
+
this.focusModes.length > 0,
|
|
727
|
+
() => x`<cx-select data-testid="cx-asset-link-format-crop-focus-mode" value=${this.focusMode} hoist style=${I({
|
|
728
|
+
width: "100%"
|
|
729
|
+
})} @cx-change=${this.onFocusModeChange} ?disabled=${this.loading || this.selectedMode?.disabledSize}>${tt(
|
|
730
|
+
this.focusModes,
|
|
731
|
+
(i) => i.value,
|
|
732
|
+
({ label: i, value: s }) => x`<cx-option value=${s}>${i}</cx-option>`
|
|
733
|
+
)}</cx-select>`
|
|
734
|
+
)}
|
|
735
|
+
${_(this.canApply, () => x`<cx-button data-testid="cx-asset-link-format-crop-apply" variant="primary" ?disabled=${this.disabledApply || this.invalidHeight || this.invalidWidth} ?loading=${this.loading} style=${I({
|
|
736
|
+
marginLeft: "auto"
|
|
737
|
+
})} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button>`)}</cx-space></cx-details>`;
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
g.styles = [U, ce];
|
|
741
|
+
g.dependencies = {
|
|
742
|
+
"cx-button": G,
|
|
743
|
+
"cx-details": Z,
|
|
744
|
+
"cx-divider": jt,
|
|
745
|
+
"cx-icon": Y,
|
|
746
|
+
"cx-icon-button": ut,
|
|
747
|
+
"cx-input": mt,
|
|
748
|
+
"cx-option": rt,
|
|
749
|
+
"cx-select": nt,
|
|
750
|
+
"cx-space": D,
|
|
751
|
+
"cx-typography": T
|
|
752
|
+
};
|
|
753
|
+
y([
|
|
754
|
+
J(".details")
|
|
755
|
+
], g.prototype, "base", 2);
|
|
756
|
+
y([
|
|
757
|
+
h({ reflect: !0, type: Boolean })
|
|
758
|
+
], g.prototype, "open", 2);
|
|
759
|
+
y([
|
|
760
|
+
h({ reflect: !0, type: Number })
|
|
761
|
+
], g.prototype, "width", 2);
|
|
762
|
+
y([
|
|
763
|
+
h({ reflect: !0, type: Number })
|
|
764
|
+
], g.prototype, "height", 2);
|
|
765
|
+
y([
|
|
766
|
+
h({ attribute: "max-width", reflect: !0, type: Number })
|
|
767
|
+
], g.prototype, "maxWidth", 2);
|
|
768
|
+
y([
|
|
769
|
+
h({ attribute: "max-height", reflect: !0, type: Number })
|
|
770
|
+
], g.prototype, "maxHeight", 2);
|
|
771
|
+
y([
|
|
772
|
+
h({ attribute: "ratio-width", reflect: !0, type: Number })
|
|
773
|
+
], g.prototype, "ratioWidth", 2);
|
|
774
|
+
y([
|
|
775
|
+
h({ attribute: "ratio-height", reflect: !0, type: Number })
|
|
776
|
+
], g.prototype, "ratioHeight", 2);
|
|
777
|
+
y([
|
|
778
|
+
h({ attribute: "percentage-width", reflect: !0, type: Number })
|
|
779
|
+
], g.prototype, "percentageWidth", 2);
|
|
780
|
+
y([
|
|
781
|
+
h({ attribute: "percentage-height", reflect: !0, type: Number })
|
|
782
|
+
], g.prototype, "percentageHeight", 2);
|
|
783
|
+
y([
|
|
784
|
+
h({ reflect: !0, type: String })
|
|
785
|
+
], g.prototype, "unit", 2);
|
|
786
|
+
y([
|
|
787
|
+
h({ attribute: "disabled-apply", reflect: !0, type: Boolean })
|
|
788
|
+
], g.prototype, "disabledApply", 2);
|
|
789
|
+
y([
|
|
790
|
+
h({ attribute: "can-apply", reflect: !0, type: Boolean })
|
|
791
|
+
], g.prototype, "canApply", 2);
|
|
792
|
+
y([
|
|
793
|
+
h({ attribute: "last-applied-setting", reflect: !1, type: Object })
|
|
794
|
+
], g.prototype, "lastAppliedSetting", 2);
|
|
795
|
+
y([
|
|
796
|
+
h({ reflect: !0, type: Boolean })
|
|
797
|
+
], g.prototype, "loading", 2);
|
|
798
|
+
y([
|
|
799
|
+
h({ attribute: "crop-modes", reflect: !1, type: Array })
|
|
800
|
+
], g.prototype, "cropModes", 2);
|
|
801
|
+
y([
|
|
802
|
+
h({ attribute: "focus-modes", reflect: !1, type: Object })
|
|
803
|
+
], g.prototype, "focusModes", 2);
|
|
804
|
+
y([
|
|
805
|
+
h({ attribute: "focus-mode", reflect: !0, type: String })
|
|
806
|
+
], g.prototype, "focusMode", 2);
|
|
807
|
+
y([
|
|
808
|
+
h({ attribute: "crop-mode", reflect: !0, type: String })
|
|
809
|
+
], g.prototype, "cropMode", 2);
|
|
810
|
+
y([
|
|
811
|
+
h({ attribute: "keep-aspect-ratio", reflect: !0, type: Boolean })
|
|
812
|
+
], g.prototype, "keepAspectRatio", 2);
|
|
813
|
+
y([
|
|
814
|
+
v()
|
|
815
|
+
], g.prototype, "invalidWidth", 2);
|
|
816
|
+
y([
|
|
817
|
+
v()
|
|
818
|
+
], g.prototype, "invalidHeight", 2);
|
|
819
|
+
y([
|
|
820
|
+
v()
|
|
821
|
+
], g.prototype, "aspectRatio", 2);
|
|
822
|
+
y([
|
|
823
|
+
C("cropMode", { waitUntilFirstUpdate: !0 }),
|
|
824
|
+
C("maxWidth", { waitUntilFirstUpdate: !0 }),
|
|
825
|
+
C("maxHeight", { waitUntilFirstUpdate: !0 }),
|
|
826
|
+
C("keepAspectRatio")
|
|
827
|
+
], g.prototype, "handleCropModeChange", 1);
|
|
828
|
+
y([
|
|
829
|
+
C("open")
|
|
830
|
+
], g.prototype, "handleOpenChange", 1);
|
|
831
|
+
g = y([
|
|
832
|
+
q("cx-asset-link-format-crop")
|
|
833
|
+
], g);
|
|
834
|
+
const ue = L`.extension{padding:var(--cx-spacing-small) var(--cx-spacing-medium);border:solid 1px var(--cx-color-neutral-200);background-color:var(--cx-color-neutral-0);& cx-select{flex:1;width:100%}}`;
|
|
835
|
+
var me = Object.defineProperty, fe = Object.getOwnPropertyDescriptor, ft = (t, e, i, s) => {
|
|
836
|
+
for (var a = s > 1 ? void 0 : s ? fe(e, i) : e, n = t.length - 1, r; n >= 0; n--)
|
|
837
|
+
(r = t[n]) && (a = (s ? r(e, i, a) : r(a)) || a);
|
|
838
|
+
return s && a && me(e, i, a), a;
|
|
839
|
+
};
|
|
840
|
+
let V = class extends N {
|
|
841
|
+
constructor() {
|
|
842
|
+
super(...arguments), this.localize = new O(this), this.value = "", this.items = [];
|
|
843
|
+
}
|
|
844
|
+
handleExtensionChange(t) {
|
|
845
|
+
const e = t.target.value;
|
|
846
|
+
this.emit("cx-asset-link-format-extension-change", {
|
|
847
|
+
detail: e
|
|
848
|
+
});
|
|
849
|
+
}
|
|
850
|
+
render() {
|
|
851
|
+
return x`<cx-space direction="vertical" spacing="small" class="extension"><cx-typography variant="body2">${this.localize.term("extension")}</cx-typography><cx-select data-label=${this.localize.term("extension")} data-testid="cx-asset-link-format-extension-select" value=${this.value} hoist @cx-change=${this.handleExtensionChange}>${tt(
|
|
852
|
+
this.items,
|
|
853
|
+
(t) => t.value,
|
|
854
|
+
(t) => x`<cx-option value=${t.value}>${t.displayName}</cx-option>`
|
|
855
|
+
)}</cx-select></cx-space>`;
|
|
856
|
+
}
|
|
857
|
+
};
|
|
858
|
+
V.styles = [U, ue];
|
|
859
|
+
V.dependencies = {
|
|
860
|
+
"cx-option": rt,
|
|
861
|
+
"cx-select": nt,
|
|
862
|
+
"cx-space": D,
|
|
863
|
+
"cx-typography": T
|
|
864
|
+
};
|
|
865
|
+
ft([
|
|
866
|
+
h({ reflect: !0, type: String })
|
|
867
|
+
], V.prototype, "value", 2);
|
|
868
|
+
ft([
|
|
869
|
+
h({ reflect: !1, type: Array })
|
|
870
|
+
], V.prototype, "items", 2);
|
|
871
|
+
V = ft([
|
|
872
|
+
q("cx-asset-link-format-extension")
|
|
873
|
+
], V);
|
|
874
|
+
const ge = L`cx-details::part(base){border-bottom-width:0}`;
|
|
875
|
+
var xe = Object.defineProperty, ye = Object.getOwnPropertyDescriptor, H = (t, e, i, s) => {
|
|
876
|
+
for (var a = s > 1 ? void 0 : s ? ye(e, i) : e, n = t.length - 1, r; n >= 0; n--)
|
|
877
|
+
(r = t[n]) && (a = (s ? r(e, i, a) : r(a)) || a);
|
|
878
|
+
return s && a && xe(e, i, a), a;
|
|
879
|
+
};
|
|
880
|
+
let M = class extends N {
|
|
881
|
+
constructor() {
|
|
882
|
+
super(...arguments), this.localize = new O(this), this.open = !1, this.value = "", this.items = [], this.loading = !1, this.scopedValue = "";
|
|
883
|
+
}
|
|
884
|
+
handleValueChange() {
|
|
885
|
+
this.scopedValue = this.value;
|
|
886
|
+
}
|
|
887
|
+
handleOpenChange() {
|
|
888
|
+
this.open || (this.scopedValue = this.value);
|
|
889
|
+
}
|
|
890
|
+
handleProxyChange(t) {
|
|
891
|
+
const e = t.target.value;
|
|
892
|
+
this.scopedValue = e;
|
|
893
|
+
}
|
|
894
|
+
/**
|
|
895
|
+
* Handles the application of the selected proxy format.
|
|
896
|
+
* This method emits a custom event with the selected proxy format when the "Apply" button is clicked.
|
|
897
|
+
* It prevents further actions if the component is currently loading.
|
|
898
|
+
*/
|
|
899
|
+
handleApply() {
|
|
900
|
+
if (this.loading)
|
|
901
|
+
return;
|
|
902
|
+
const t = this.items.find(
|
|
903
|
+
(e) => e.id === this.scopedValue
|
|
904
|
+
);
|
|
905
|
+
t && this.emit("cx-asset-link-format-proxy-change", {
|
|
906
|
+
detail: t
|
|
907
|
+
});
|
|
908
|
+
}
|
|
909
|
+
/**
|
|
910
|
+
* Handles showing the details section.
|
|
911
|
+
* This method prevents the event from propagating if the target is not the base element, such as tooltips, select dropdowns, or other interactive elements inside the details.
|
|
912
|
+
* This ensures that the details section is only shown when the user interacts with the base element.
|
|
913
|
+
*/
|
|
914
|
+
onShowDetails(t) {
|
|
915
|
+
t.target !== this.base && t.stopPropagation();
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Handles hiding the details section.
|
|
919
|
+
* This method prevents the event from propagating if the target is not the base element, such as tooltips, select dropdowns, or other interactive elements inside the details.
|
|
920
|
+
* This ensures that the details section is only hidden when the user interacts with the base element.
|
|
921
|
+
*/
|
|
922
|
+
onHideDetails(t) {
|
|
923
|
+
t.target !== this.base && t.stopPropagation();
|
|
924
|
+
}
|
|
925
|
+
render() {
|
|
926
|
+
return x`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="photo_size_select_large"></cx-icon></div><cx-typography variant="body2">${this.localize.term("format")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small" class="format"><cx-select data-label=${this.localize.term("imageFormat")} data-testid="cx-asset-link-format-proxy-select" value=${this.scopedValue} hoist @cx-change=${this.handleProxyChange} ?disabled=${this.loading}>${tt(
|
|
927
|
+
this.items,
|
|
928
|
+
(t) => t.id,
|
|
929
|
+
(t) => x`<cx-option value=${t.id}>${t.proxyLabel}</cx-option>`
|
|
930
|
+
)}</cx-select><cx-button data-testid="cx-asset-link-format-proxy-apply" variant="primary" style=${I({
|
|
931
|
+
"margin-left": "auto"
|
|
932
|
+
})} ?disabled=${this.scopedValue === this.value} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button></cx-space></cx-details>`;
|
|
933
|
+
}
|
|
934
|
+
};
|
|
935
|
+
M.styles = [U, ge];
|
|
936
|
+
M.dependencies = {
|
|
937
|
+
"cx-button": G,
|
|
938
|
+
"cx-details": Z,
|
|
939
|
+
"cx-icon": Y,
|
|
940
|
+
"cx-option": rt,
|
|
941
|
+
"cx-select": nt,
|
|
942
|
+
"cx-space": D,
|
|
943
|
+
"cx-typography": T
|
|
944
|
+
};
|
|
945
|
+
H([
|
|
946
|
+
J(".details")
|
|
947
|
+
], M.prototype, "base", 2);
|
|
948
|
+
H([
|
|
949
|
+
h({ reflect: !0, type: Boolean })
|
|
950
|
+
], M.prototype, "open", 2);
|
|
951
|
+
H([
|
|
952
|
+
h({ reflect: !0, type: String })
|
|
953
|
+
], M.prototype, "value", 2);
|
|
954
|
+
H([
|
|
955
|
+
h({ reflect: !1, type: Array })
|
|
956
|
+
], M.prototype, "items", 2);
|
|
957
|
+
H([
|
|
958
|
+
h({ reflect: !0, type: Boolean })
|
|
959
|
+
], M.prototype, "loading", 2);
|
|
960
|
+
H([
|
|
961
|
+
v()
|
|
962
|
+
], M.prototype, "scopedValue", 2);
|
|
963
|
+
H([
|
|
964
|
+
C("value")
|
|
965
|
+
], M.prototype, "handleValueChange", 1);
|
|
966
|
+
H([
|
|
967
|
+
C("open", { waitUntilFirstUpdate: !0 })
|
|
968
|
+
], M.prototype, "handleOpenChange", 1);
|
|
969
|
+
M = H([
|
|
970
|
+
q("cx-asset-link-format-proxy")
|
|
971
|
+
], M);
|
|
972
|
+
const Se = L`cx-details::part(base){border-bottom-width:0}`;
|
|
973
|
+
var be = Object.defineProperty, ze = Object.getOwnPropertyDescriptor, B = (t, e, i, s) => {
|
|
974
|
+
for (var a = s > 1 ? void 0 : s ? ze(e, i) : e, n = t.length - 1, r; n >= 0; n--)
|
|
975
|
+
(r = t[n]) && (a = (s ? r(e, i, a) : r(a)) || a);
|
|
976
|
+
return s && a && be(e, i, a), a;
|
|
977
|
+
};
|
|
978
|
+
let F = class extends N {
|
|
979
|
+
constructor() {
|
|
980
|
+
super(...arguments), this.localize = new O(this), this.open = !1, this.value = 100, this.loading = !1, this.canApply = !1, this.scopedValue = 100;
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* A computed property that checks if the current quality value is invalid.
|
|
984
|
+
* The value is considered invalid if it is not a number, less than 1, greater than 100, or equal to the current value.
|
|
985
|
+
* @return {boolean} True if the value is invalid, false otherwise.
|
|
986
|
+
*/
|
|
987
|
+
get invalidValue() {
|
|
988
|
+
return isNaN(Number(this.scopedValue)) || Number(this.scopedValue) < 1 || Number(this.scopedValue) > 100 || this.value === this.scopedValue;
|
|
989
|
+
}
|
|
990
|
+
handleValueChange() {
|
|
991
|
+
this.scopedValue = this.value;
|
|
992
|
+
}
|
|
993
|
+
handleQualityChange(t) {
|
|
994
|
+
const e = t.target.value;
|
|
995
|
+
this.scopedValue = Number(e), !this.canApply && !this.invalidValue && this.emit("cx-asset-link-format-quality-change", {
|
|
996
|
+
detail: this.scopedValue
|
|
997
|
+
});
|
|
998
|
+
}
|
|
999
|
+
/**
|
|
1000
|
+
* Handles the application of the input quality.
|
|
1001
|
+
* This method emits a custom event with the input quality when the "Apply" button is clicked.
|
|
1002
|
+
* It prevents further actions if the component is currently loading.
|
|
1003
|
+
*/
|
|
1004
|
+
handleApply() {
|
|
1005
|
+
this.loading || this.emit("cx-asset-link-format-quality-change", {
|
|
1006
|
+
detail: Number(this.scopedValue)
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
/**
|
|
1010
|
+
* Handles showing the details section.
|
|
1011
|
+
* This method prevents the event from propagating if the target is not the base element, such as tooltips, select dropdowns, or other interactive elements inside the details.
|
|
1012
|
+
* This ensures that the details section is only shown when the user interacts with the base element.
|
|
1013
|
+
*/
|
|
1014
|
+
onShowDetails(t) {
|
|
1015
|
+
t.target !== this.base && t.stopPropagation();
|
|
1016
|
+
}
|
|
1017
|
+
/**
|
|
1018
|
+
* Handles hiding the details section.
|
|
1019
|
+
* This method prevents the event from propagating if the target is not the base element, such as tooltips, select dropdowns, or other interactive elements inside the details.
|
|
1020
|
+
* This ensures that the details section is only hidden when the user interacts with the base element.
|
|
1021
|
+
*/
|
|
1022
|
+
onHideDetails(t) {
|
|
1023
|
+
t.target !== this.base && t.stopPropagation();
|
|
1024
|
+
}
|
|
1025
|
+
render() {
|
|
1026
|
+
return x`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div class="details__summary__icon"><div part="icon"><cx-icon name="blur_on"></cx-icon></div></div><cx-typography variant="body2">${this.localize.term("quality")}</cx-typography></cx-space><cx-space spacing="small"><cx-tooltip data-testid="cx-asset-link-format-quality-tooltip" content=${this.localize.term("qualityHelpText")} hoist><cx-input data-testid="cx-asset-link-format-quality" class="details__checkbox" mask="num" .maskBlocks=${{ num: { mask: Number, max: 100, min: 1 } }} value=${this.scopedValue.toString()} style=${I({
|
|
1027
|
+
flex: "1"
|
|
1028
|
+
})} @cx-input=${this.handleQualityChange}></cx-input></cx-tooltip>${_(this.canApply, () => x`<cx-button data-testid="cx-asset-link-format-quality-apply" variant="primary" ?disabled=${this.invalidValue} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button>`)}</cx-space></cx-details>`;
|
|
1029
|
+
}
|
|
1030
|
+
};
|
|
1031
|
+
F.styles = [U, Se];
|
|
1032
|
+
F.dependencies = {
|
|
1033
|
+
"cx-button": G,
|
|
1034
|
+
"cx-details": Z,
|
|
1035
|
+
"cx-icon": Y,
|
|
1036
|
+
"cx-input": mt,
|
|
1037
|
+
"cx-space": D,
|
|
1038
|
+
"cx-tooltip": It,
|
|
1039
|
+
"cx-typography": T
|
|
1040
|
+
};
|
|
1041
|
+
B([
|
|
1042
|
+
J(".details")
|
|
1043
|
+
], F.prototype, "base", 2);
|
|
1044
|
+
B([
|
|
1045
|
+
h({ reflect: !0, type: Boolean })
|
|
1046
|
+
], F.prototype, "open", 2);
|
|
1047
|
+
B([
|
|
1048
|
+
h({ reflect: !0, type: Number })
|
|
1049
|
+
], F.prototype, "value", 2);
|
|
1050
|
+
B([
|
|
1051
|
+
h({ reflect: !0, type: Boolean })
|
|
1052
|
+
], F.prototype, "loading", 2);
|
|
1053
|
+
B([
|
|
1054
|
+
h({ attribute: "can-apply", reflect: !0, type: Boolean })
|
|
1055
|
+
], F.prototype, "canApply", 2);
|
|
1056
|
+
B([
|
|
1057
|
+
v()
|
|
1058
|
+
], F.prototype, "scopedValue", 2);
|
|
1059
|
+
B([
|
|
1060
|
+
C("value")
|
|
1061
|
+
], F.prototype, "handleValueChange", 1);
|
|
1062
|
+
F = B([
|
|
1063
|
+
q("cx-asset-link-format-quality")
|
|
1064
|
+
], F);
|
|
1065
|
+
const Ae = L`cx-details::part(base){border-bottom-width:0}cx-space{width:100%}cx-space cx-input{flex:1}.resize__unit-select{width:120px}.resize__input-group{flex:1;display:flex}`;
|
|
1066
|
+
var we = Object.defineProperty, ve = Object.getOwnPropertyDescriptor, k = (t, e, i, s) => {
|
|
1067
|
+
for (var a = s > 1 ? void 0 : s ? ve(e, i) : e, n = t.length - 1, r; n >= 0; n--)
|
|
1068
|
+
(r = t[n]) && (a = (s ? r(e, i, a) : r(a)) || a);
|
|
1069
|
+
return s && a && we(e, i, a), a;
|
|
1070
|
+
};
|
|
1071
|
+
let z = class extends N {
|
|
1072
|
+
constructor() {
|
|
1073
|
+
super(...arguments), this.localize = new O(this), this.open = !1, this.width = 0, this.height = 0, this.maxWidth = 0, this.maxHeight = 0, this.ratioWidth = 1, this.ratioHeight = 1, this.unit = o.Pixel, this.lastAppliedSetting = {
|
|
1074
|
+
[o.Pixel]: { height: 0, width: 0 },
|
|
1075
|
+
[o.AspectRatio]: { height: 1, width: 1 }
|
|
1076
|
+
}, this.loading = !1, this.canApply = !1, this.keepAspectRatio = !1, this.invalidWidth = !1, this.invalidHeight = !1, this.aspectRatio = 0;
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* A computed property that checks if the current resize settings match the last applied settings.
|
|
1080
|
+
* This is used to disable the apply button when no changes have been made.
|
|
1081
|
+
* @returns {boolean} True if the current settings match the last applied settings, false otherwise.
|
|
1082
|
+
*/
|
|
1083
|
+
get disabledApply() {
|
|
1084
|
+
return this.lastAppliedSetting[this.unit].width === this.width && this.lastAppliedSetting[this.unit].height === this.height;
|
|
1085
|
+
}
|
|
1086
|
+
async handleCropModeChange() {
|
|
1087
|
+
if (this.keepAspectRatio) {
|
|
1088
|
+
if (this.unit === o.Pixel && this.width && this.height) {
|
|
1089
|
+
this.aspectRatio = this.width / this.height;
|
|
1090
|
+
return;
|
|
1091
|
+
} else if (this.unit === o.AspectRatio && this.ratioWidth && this.ratioHeight) {
|
|
1092
|
+
this.aspectRatio = this.ratioWidth / this.ratioHeight;
|
|
1093
|
+
return;
|
|
1094
|
+
}
|
|
1095
|
+
}
|
|
1096
|
+
if (this.maxWidth && this.maxHeight && Number.isFinite(this.maxWidth) && Number.isFinite(this.maxHeight)) {
|
|
1097
|
+
this.aspectRatio = this.maxWidth / this.maxHeight;
|
|
1098
|
+
return;
|
|
1099
|
+
}
|
|
1100
|
+
this.aspectRatio = 1;
|
|
1101
|
+
}
|
|
1102
|
+
async handleOpenChange() {
|
|
1103
|
+
if (await this.updateComplete, !this.open) {
|
|
1104
|
+
if (!this.canApply)
|
|
1105
|
+
return;
|
|
1106
|
+
this.width = this.lastAppliedSetting[o.Pixel].width, this.height = this.lastAppliedSetting[o.Pixel].height, this.unit = o.Pixel, this.emit("cx-asset-link-format-resize-change", {
|
|
1107
|
+
detail: {
|
|
1108
|
+
height: this.lastAppliedSetting[o.Pixel].height,
|
|
1109
|
+
keepAspectRatio: this.keepAspectRatio,
|
|
1110
|
+
unit: o.Pixel,
|
|
1111
|
+
width: this.lastAppliedSetting[o.Pixel].width
|
|
1112
|
+
}
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
handleWidthChange(t) {
|
|
1117
|
+
if (!t.target.value) {
|
|
1118
|
+
this.invalidWidth = !0;
|
|
1119
|
+
return;
|
|
1120
|
+
}
|
|
1121
|
+
this.invalidWidth = !1;
|
|
1122
|
+
let e = Number(t.target.value);
|
|
1123
|
+
this.unit === o.Pixel && (e = Math.max(Math.min(e, this.maxWidth), 1)), t.target.value = e.toString();
|
|
1124
|
+
let i = this.unit === o.Pixel ? this.height : this.ratioHeight;
|
|
1125
|
+
this.keepAspectRatio && (i = Math.min(
|
|
1126
|
+
Math.round(e / this.aspectRatio),
|
|
1127
|
+
this.maxHeight
|
|
1128
|
+
), this.invalidHeight = !1), this.emit("cx-asset-link-format-resize-change", {
|
|
1129
|
+
detail: {
|
|
1130
|
+
height: i,
|
|
1131
|
+
keepAspectRatio: this.keepAspectRatio,
|
|
1132
|
+
unit: this.unit,
|
|
1133
|
+
width: e
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
handleHeightChange(t) {
|
|
1138
|
+
if (!t.target.value) {
|
|
1139
|
+
this.invalidHeight = !0;
|
|
1140
|
+
return;
|
|
1141
|
+
}
|
|
1142
|
+
this.invalidHeight = !1;
|
|
1143
|
+
let e = Number(t.target.value);
|
|
1144
|
+
this.unit === o.Pixel && (e = Math.max(Math.min(e, this.maxHeight), 1)), t.target.value = e.toString();
|
|
1145
|
+
let i = this.unit === o.Pixel ? this.width : this.ratioWidth;
|
|
1146
|
+
this.keepAspectRatio && (i = Math.min(
|
|
1147
|
+
Math.round(e * this.aspectRatio),
|
|
1148
|
+
this.maxWidth
|
|
1149
|
+
), this.invalidWidth = !1), this.emit("cx-asset-link-format-resize-change", {
|
|
1150
|
+
detail: {
|
|
1151
|
+
height: e,
|
|
1152
|
+
keepAspectRatio: this.keepAspectRatio,
|
|
1153
|
+
unit: this.unit,
|
|
1154
|
+
width: i
|
|
1155
|
+
}
|
|
1156
|
+
});
|
|
1157
|
+
}
|
|
1158
|
+
onUnitChange(t) {
|
|
1159
|
+
t.target.value === o.AspectRatio ? this.emit("cx-asset-link-format-resize-change", {
|
|
1160
|
+
detail: {
|
|
1161
|
+
height: this.lastAppliedSetting[o.AspectRatio].height,
|
|
1162
|
+
keepAspectRatio: this.keepAspectRatio,
|
|
1163
|
+
unit: o.AspectRatio,
|
|
1164
|
+
width: this.lastAppliedSetting[o.AspectRatio].width
|
|
1165
|
+
}
|
|
1166
|
+
}) : this.emit("cx-asset-link-format-resize-change", {
|
|
1167
|
+
detail: {
|
|
1168
|
+
height: this.lastAppliedSetting[o.Pixel].height,
|
|
1169
|
+
keepAspectRatio: this.keepAspectRatio,
|
|
1170
|
+
unit: o.Pixel,
|
|
1171
|
+
width: this.lastAppliedSetting[o.Pixel].width
|
|
1172
|
+
}
|
|
1173
|
+
});
|
|
1174
|
+
}
|
|
1175
|
+
handleApply() {
|
|
1176
|
+
this.loading || this.emit("cx-asset-link-format-resize-apply", {
|
|
1177
|
+
detail: {
|
|
1178
|
+
height: this.height,
|
|
1179
|
+
unit: this.unit,
|
|
1180
|
+
width: this.width
|
|
1181
|
+
}
|
|
1182
|
+
});
|
|
1183
|
+
}
|
|
1184
|
+
/**
|
|
1185
|
+
* Handles showing the details section.
|
|
1186
|
+
* This method prevents the event from propagating if the target is not the base element, such as tooltips, select dropdowns, or other interactive elements inside the details.
|
|
1187
|
+
* This ensures that the details section is only shown when the user interacts with the base element.
|
|
1188
|
+
*/
|
|
1189
|
+
onShowDetails(t) {
|
|
1190
|
+
t.target !== this.base && t.stopPropagation();
|
|
1191
|
+
}
|
|
1192
|
+
/**
|
|
1193
|
+
* Handles hiding the details section.
|
|
1194
|
+
* This method prevents the event from propagating if the target is not the base element, such as tooltips, select dropdowns, or other interactive elements inside the details.
|
|
1195
|
+
* This ensures that the details section is only hidden when the user interacts with the base element.
|
|
1196
|
+
*/
|
|
1197
|
+
onHideDetails(t) {
|
|
1198
|
+
t.target !== this.base && t.stopPropagation();
|
|
1199
|
+
}
|
|
1200
|
+
handleAspectRatioClick() {
|
|
1201
|
+
this.emit("cx-asset-link-format-resize-change", {
|
|
1202
|
+
detail: {
|
|
1203
|
+
height: this.unit === o.Pixel ? this.height : this.ratioHeight,
|
|
1204
|
+
keepAspectRatio: !this.keepAspectRatio,
|
|
1205
|
+
unit: this.unit,
|
|
1206
|
+
width: this.unit === o.Pixel ? this.width : this.ratioWidth
|
|
1207
|
+
}
|
|
1208
|
+
});
|
|
1209
|
+
}
|
|
1210
|
+
render() {
|
|
1211
|
+
return x`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="aspect_ratio"></cx-icon></div><cx-typography variant="body2">${this.localize.term("resize")}</cx-typography></cx-space><cx-space direction="vertical" spacing="small"><cx-space spacing="small"><div class="resize__input-group"><cx-input data-testid="cx-asset-link-format-resize-width" placeholder=${this.localize.term("width")} mask="num" .maskBlocks=${{ num: { mask: Number, min: 1 } }} value=${this.unit === o.Pixel ? this.width.toString() : this.ratioWidth.toString()} @cx-input=${this.handleWidthChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
1212
|
+
W
|
|
1213
|
+
</cx-typography></cx-input><cx-icon-button data-testid="cx-asset-link-format-resize-aspect-ratio" name=${this.keepAspectRatio ? "insert_link" : "link_off"} @click=${this.handleAspectRatioClick} style=${I({
|
|
1214
|
+
color: this.keepAspectRatio ? "var(--cx-color-primary)" : void 0
|
|
1215
|
+
})} ?disabled=${this.loading}></cx-icon-button><cx-input data-testid="cx-asset-link-format-resize-height" placeholder=${this.localize.term("height")} mask="num" .maskBlocks=${{ num: { mask: Number, min: 1 } }} value=${this.unit === o.Pixel ? this.height.toString() : this.ratioHeight.toString()} @cx-input=${this.handleHeightChange} required ?disabled=${this.loading}><cx-typography slot="prefix" variant="body3" part="input-label">
|
|
1216
|
+
H
|
|
1217
|
+
</cx-typography></cx-input></div><cx-select data-testid="cx-asset-link-format-resize-unit" value=${this.unit} hoist class="resize__unit-select" @cx-change=${this.onUnitChange}><cx-option value=${o.Pixel}>${this.localize.term("pixels")}</cx-option><cx-option value=${o.AspectRatio}>${this.localize.term("aspectRatio")}</cx-option></cx-select></cx-space>${_(this.canApply, () => x`<cx-button data-testid="cx-asset-link-format-resize-apply" variant="primary" ?disabled=${this.disabledApply || this.invalidHeight || this.invalidWidth} ?loading=${this.loading} style=${I({
|
|
1218
|
+
marginLeft: "auto"
|
|
1219
|
+
})} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button>`)}</cx-space></cx-details>`;
|
|
1220
|
+
}
|
|
1221
|
+
};
|
|
1222
|
+
z.styles = [U, Ae];
|
|
1223
|
+
z.dependencies = {
|
|
1224
|
+
"cx-button": G,
|
|
1225
|
+
"cx-details": Z,
|
|
1226
|
+
"cx-icon": Y,
|
|
1227
|
+
"cx-icon-button": ut,
|
|
1228
|
+
"cx-input": mt,
|
|
1229
|
+
"cx-option": rt,
|
|
1230
|
+
"cx-select": nt,
|
|
1231
|
+
"cx-space": D,
|
|
1232
|
+
"cx-typography": T
|
|
1233
|
+
};
|
|
1234
|
+
k([
|
|
1235
|
+
J(".details")
|
|
1236
|
+
], z.prototype, "base", 2);
|
|
1237
|
+
k([
|
|
1238
|
+
h({ reflect: !0, type: Boolean })
|
|
1239
|
+
], z.prototype, "open", 2);
|
|
1240
|
+
k([
|
|
1241
|
+
h({ reflect: !0, type: Number })
|
|
1242
|
+
], z.prototype, "width", 2);
|
|
1243
|
+
k([
|
|
1244
|
+
h({ reflect: !0, type: Number })
|
|
1245
|
+
], z.prototype, "height", 2);
|
|
1246
|
+
k([
|
|
1247
|
+
h({ attribute: "max-width", reflect: !0, type: Number })
|
|
1248
|
+
], z.prototype, "maxWidth", 2);
|
|
1249
|
+
k([
|
|
1250
|
+
h({ attribute: "max-height", reflect: !0, type: Number })
|
|
1251
|
+
], z.prototype, "maxHeight", 2);
|
|
1252
|
+
k([
|
|
1253
|
+
h({ attribute: "ratio-width", reflect: !0, type: Number })
|
|
1254
|
+
], z.prototype, "ratioWidth", 2);
|
|
1255
|
+
k([
|
|
1256
|
+
h({ attribute: "ratio-height", reflect: !0, type: Number })
|
|
1257
|
+
], z.prototype, "ratioHeight", 2);
|
|
1258
|
+
k([
|
|
1259
|
+
h({ reflect: !0, type: String })
|
|
1260
|
+
], z.prototype, "unit", 2);
|
|
1261
|
+
k([
|
|
1262
|
+
h({ attribute: "last-applied-setting", reflect: !1, type: Object })
|
|
1263
|
+
], z.prototype, "lastAppliedSetting", 2);
|
|
1264
|
+
k([
|
|
1265
|
+
h({ reflect: !0, type: Boolean })
|
|
1266
|
+
], z.prototype, "loading", 2);
|
|
1267
|
+
k([
|
|
1268
|
+
h({ attribute: "can-apply", reflect: !0, type: Boolean })
|
|
1269
|
+
], z.prototype, "canApply", 2);
|
|
1270
|
+
k([
|
|
1271
|
+
h({ attribute: "keep-aspect-ratio", reflect: !0, type: Boolean })
|
|
1272
|
+
], z.prototype, "keepAspectRatio", 2);
|
|
1273
|
+
k([
|
|
1274
|
+
v()
|
|
1275
|
+
], z.prototype, "invalidWidth", 2);
|
|
1276
|
+
k([
|
|
1277
|
+
v()
|
|
1278
|
+
], z.prototype, "invalidHeight", 2);
|
|
1279
|
+
k([
|
|
1280
|
+
v()
|
|
1281
|
+
], z.prototype, "aspectRatio", 2);
|
|
1282
|
+
k([
|
|
1283
|
+
C("cropMode", { waitUntilFirstUpdate: !0 }),
|
|
1284
|
+
C("maxWidth", { waitUntilFirstUpdate: !0 }),
|
|
1285
|
+
C("maxHeight", { waitUntilFirstUpdate: !0 }),
|
|
1286
|
+
C("keepAspectRatio")
|
|
1287
|
+
], z.prototype, "handleCropModeChange", 1);
|
|
1288
|
+
k([
|
|
1289
|
+
C("open")
|
|
1290
|
+
], z.prototype, "handleOpenChange", 1);
|
|
1291
|
+
z = k([
|
|
1292
|
+
q("cx-asset-link-format-resize")
|
|
1293
|
+
], z);
|
|
1294
|
+
const ke = L`cx-details::part(base){border-bottom-width:0}`;
|
|
1295
|
+
var Ce = Object.defineProperty, $e = Object.getOwnPropertyDescriptor, j = (t, e, i, s) => {
|
|
1296
|
+
for (var a = s > 1 ? void 0 : s ? $e(e, i) : e, n = t.length - 1, r; n >= 0; n--)
|
|
1297
|
+
(r = t[n]) && (a = (s ? r(e, i, a) : r(a)) || a);
|
|
1298
|
+
return s && a && Ce(e, i, a), a;
|
|
1299
|
+
};
|
|
1300
|
+
let E = class extends N {
|
|
1301
|
+
constructor() {
|
|
1302
|
+
super(...arguments), this.localize = new O(this), this.open = !1, this.value = 0, this.defaultValue = 0, this.loading = !1, this.canApply = !1;
|
|
1303
|
+
}
|
|
1304
|
+
handleOpenChange() {
|
|
1305
|
+
if (!this.open) {
|
|
1306
|
+
if (!this.canApply)
|
|
1307
|
+
return;
|
|
1308
|
+
this.emit("cx-asset-link-format-rotation-change", {
|
|
1309
|
+
detail: 0
|
|
1310
|
+
});
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
handleRotationChange(t) {
|
|
1314
|
+
const e = t.target.value, i = zt(Number(e));
|
|
1315
|
+
(Number(e) > 360 || Number(e) < -360) && (t.target.value = i.toString()), this.emit("cx-asset-link-format-rotation-change", {
|
|
1316
|
+
detail: i
|
|
1317
|
+
});
|
|
1318
|
+
}
|
|
1319
|
+
handleButtonClick(t) {
|
|
1320
|
+
this.emit("cx-asset-link-format-rotation-change", {
|
|
1321
|
+
detail: zt(t)
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
handleClockwiseClick() {
|
|
1325
|
+
this.handleButtonClick(this.value + 90);
|
|
1326
|
+
}
|
|
1327
|
+
handleCounterClockwiseClick() {
|
|
1328
|
+
this.handleButtonClick(this.value - 90);
|
|
1329
|
+
}
|
|
1330
|
+
/**
|
|
1331
|
+
* Handles the application of the input rotation.
|
|
1332
|
+
* This method emits a custom event with the input rotation when the "Apply" button is clicked.
|
|
1333
|
+
* It prevents further actions if the component is currently loading.
|
|
1334
|
+
*/
|
|
1335
|
+
handleApply() {
|
|
1336
|
+
this.value === 360 || this.value === -360 || this.loading || this.emit("cx-asset-link-format-rotation-apply", {
|
|
1337
|
+
detail: this.value
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
render() {
|
|
1341
|
+
return x`<cx-details class="details" ?open=${this.open}><cx-space slot="summary" align-items="center"><div part="icon"><cx-icon name="rotate_90_degrees_cw"></cx-icon></div><cx-typography variant="body2">Rotate</cx-typography></cx-space><cx-space spacing="small"><cx-button-group label=${this.localize.term("history")}><cx-icon-button data-testid="cx-asset-link-format-rotation-ccw" name="rotate_90_degrees_ccw" label=${this.localize.term("undo")} outline size="small" ?disabled=${this.loading || this.value === -360} @click=${this.handleCounterClockwiseClick}></cx-icon-button><cx-icon-button data-testid="cx-asset-link-format-rotation-cw" name="rotate_90_degrees_cw" label=${this.localize.term("redo")} outline size="small" ?disabled=${this.loading || this.value === 360} @click=${this.handleClockwiseClick}></cx-icon-button></cx-button-group><cx-input data-testid="cx-asset-link-format-rotation" value=${(this.value + this.defaultValue).toString()} placeholder="0" mask="num" .maskBlocks=${{ num: { mask: Number, max: 360, min: -360, signed: !0 } }} ?disabled=${this.loading} style=${I({
|
|
1342
|
+
flex: "none",
|
|
1343
|
+
width: "80px"
|
|
1344
|
+
})} @cx-input=${this.handleRotationChange}></cx-input>${_(this.canApply, () => x`<cx-button data-testid="cx-asset-link-format-rotation-apply" variant="primary" ?disabled=${this.value === 0} ?loading=${this.loading} @click=${this.handleApply}>${this.localize.term("apply")}</cx-button>`)}</cx-space></cx-details>`;
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
E.styles = [U, ke];
|
|
1348
|
+
E.dependencies = {
|
|
1349
|
+
"cx-button": G,
|
|
1350
|
+
"cx-button-group": Gt,
|
|
1351
|
+
"cx-details": Z,
|
|
1352
|
+
"cx-icon": Y,
|
|
1353
|
+
"cx-icon-button": ut,
|
|
1354
|
+
"cx-space": D,
|
|
1355
|
+
"cx-typography": T
|
|
1356
|
+
};
|
|
1357
|
+
j([
|
|
1358
|
+
J(".details")
|
|
1359
|
+
], E.prototype, "base", 2);
|
|
1360
|
+
j([
|
|
1361
|
+
h({ reflect: !0, type: Boolean })
|
|
1362
|
+
], E.prototype, "open", 2);
|
|
1363
|
+
j([
|
|
1364
|
+
h({ reflect: !0, type: Number })
|
|
1365
|
+
], E.prototype, "value", 2);
|
|
1366
|
+
j([
|
|
1367
|
+
h({ attribute: "default-value", reflect: !0, type: Number })
|
|
1368
|
+
], E.prototype, "defaultValue", 2);
|
|
1369
|
+
j([
|
|
1370
|
+
h({ reflect: !0, type: Boolean })
|
|
1371
|
+
], E.prototype, "loading", 2);
|
|
1372
|
+
j([
|
|
1373
|
+
h({ attribute: "can-apply", reflect: !0, type: Boolean })
|
|
1374
|
+
], E.prototype, "canApply", 2);
|
|
1375
|
+
j([
|
|
1376
|
+
C("open", { waitUntilFirstUpdate: !0 })
|
|
1377
|
+
], E.prototype, "handleOpenChange", 1);
|
|
1378
|
+
E = j([
|
|
1379
|
+
q("cx-asset-link-format-rotation")
|
|
1380
|
+
], E);
|
|
1381
|
+
const Re = L`cx-details::part(base){border-bottom-width:0}`;
|
|
1382
|
+
var _e = Object.defineProperty, Pe = Object.getOwnPropertyDescriptor, ht = (t, e, i, s) => {
|
|
1383
|
+
for (var a = s > 1 ? void 0 : s ? Pe(e, i) : e, n = t.length - 1, r; n >= 0; n--)
|
|
1384
|
+
(r = t[n]) && (a = (s ? r(e, i, a) : r(a)) || a);
|
|
1385
|
+
return s && a && _e(e, i, a), a;
|
|
1386
|
+
};
|
|
1387
|
+
let W = class extends N {
|
|
1388
|
+
constructor() {
|
|
1389
|
+
super(...arguments), this.localize = new O(this), this.open = !1, this.value = !1;
|
|
1390
|
+
}
|
|
1391
|
+
handleApply(t) {
|
|
1392
|
+
this.emit("cx-asset-link-format-metadata-change", {
|
|
1393
|
+
detail: t.target.checked
|
|
1394
|
+
});
|
|
1395
|
+
}
|
|
1396
|
+
/**
|
|
1397
|
+
* Handles showing the details section.
|
|
1398
|
+
* This method prevents the event from propagating if the target is not the base element, such as tooltips, select dropdowns, or other interactive elements inside the details.
|
|
1399
|
+
* This ensures that the details section is only shown when the user interacts with the base element.
|
|
1400
|
+
*/
|
|
1401
|
+
onShowDetails(t) {
|
|
1402
|
+
t.target !== this.base && t.stopPropagation();
|
|
1403
|
+
}
|
|
1404
|
+
/**
|
|
1405
|
+
* Handles hiding the details section.
|
|
1406
|
+
* This method prevents the event from propagating if the target is not the base element, such as tooltips, select dropdowns, or other interactive elements inside the details.
|
|
1407
|
+
* This ensures that the details section is only hidden when the user interacts with the base element.
|
|
1408
|
+
*/
|
|
1409
|
+
onHideDetails(t) {
|
|
1410
|
+
t.target !== this.base && t.stopPropagation();
|
|
1411
|
+
}
|
|
1412
|
+
render() {
|
|
1413
|
+
return x`<cx-details class="details" ?open=${this.open} @cx-show=${this.onShowDetails} @cx-hide=${this.onHideDetails}><cx-space slot="summary" align-items="center"><div class="details__summary__icon"><div part="icon"><cx-icon name="short_text"></cx-icon></div></div><cx-typography variant="body2">${this.localize.term("metadata")}</cx-typography></cx-space><cx-space spacing="small"><cx-tooltip data-testid="cx-asset-link-format-metadata-tooltip" content=${this.localize.term("metadataHelpText")} hoist><cx-checkbox data-testid="cx-asset-link-format-metadata" class="details__checkbox" ?checked=${this.value} @cx-change=${this.handleApply}>${this.localize.term("preserveMetadata")}</cx-checkbox></cx-tooltip></cx-space></cx-details>`;
|
|
1414
|
+
}
|
|
1415
|
+
};
|
|
1416
|
+
W.styles = [U, Re];
|
|
1417
|
+
W.dependencies = {
|
|
1418
|
+
"cx-button": G,
|
|
1419
|
+
"cx-checkbox": Qt,
|
|
1420
|
+
"cx-details": Z,
|
|
1421
|
+
"cx-icon": Y,
|
|
1422
|
+
"cx-space": D,
|
|
1423
|
+
"cx-tooltip": It,
|
|
1424
|
+
"cx-typography": T
|
|
1425
|
+
};
|
|
1426
|
+
ht([
|
|
1427
|
+
J(".details")
|
|
1428
|
+
], W.prototype, "base", 2);
|
|
1429
|
+
ht([
|
|
1430
|
+
h({ reflect: !0, type: Boolean })
|
|
1431
|
+
], W.prototype, "open", 2);
|
|
1432
|
+
ht([
|
|
1433
|
+
h({ reflect: !0, type: Boolean })
|
|
1434
|
+
], W.prototype, "value", 2);
|
|
1435
|
+
W = ht([
|
|
1436
|
+
q("cx-asset-link-format-metadata")
|
|
1437
|
+
], W);
|
|
1438
|
+
var Me = Object.defineProperty, Fe = Object.getOwnPropertyDescriptor, d = (t, e, i, s) => {
|
|
1439
|
+
for (var a = s > 1 ? void 0 : s ? Fe(e, i) : e, n = t.length - 1, r; n >= 0; n--)
|
|
1440
|
+
(r = t[n]) && (a = (s ? r(e, i, a) : r(a)) || a);
|
|
1441
|
+
return s && a && Me(e, i, a), a;
|
|
1442
|
+
};
|
|
1443
|
+
let p = class extends N {
|
|
1444
|
+
constructor() {
|
|
1445
|
+
super(), this.localize = new O(this), this.baseUrl = void 0, this.token = void 0, this.asset = void 0, this.cropModes = [
|
|
1446
|
+
{
|
|
1447
|
+
label: "Free",
|
|
1448
|
+
value: "free"
|
|
1449
|
+
},
|
|
1450
|
+
{
|
|
1451
|
+
label: "Widescreen (16:9)",
|
|
1452
|
+
value: "16:9"
|
|
1453
|
+
},
|
|
1454
|
+
{
|
|
1455
|
+
label: "Phone (9:16)",
|
|
1456
|
+
value: "9:16"
|
|
1457
|
+
},
|
|
1458
|
+
{
|
|
1459
|
+
label: "Presentation (4:3)",
|
|
1460
|
+
value: "4:3"
|
|
1461
|
+
},
|
|
1462
|
+
{
|
|
1463
|
+
label: "Square (1:1)",
|
|
1464
|
+
value: "1:1"
|
|
1465
|
+
},
|
|
1466
|
+
{
|
|
1467
|
+
label: "Landscape (3:2)",
|
|
1468
|
+
value: "3:2"
|
|
1469
|
+
},
|
|
1470
|
+
{
|
|
1471
|
+
label: "Portrait (2:3)",
|
|
1472
|
+
value: "2:3"
|
|
1473
|
+
},
|
|
1474
|
+
{
|
|
1475
|
+
auto: !0,
|
|
1476
|
+
disabledSize: !0,
|
|
1477
|
+
label: "Azure AI",
|
|
1478
|
+
value: "AzureAI"
|
|
1479
|
+
}
|
|
1480
|
+
], this.focusModes = [
|
|
1481
|
+
{
|
|
1482
|
+
label: "Manual focus",
|
|
1483
|
+
value: "manual"
|
|
1484
|
+
},
|
|
1485
|
+
{
|
|
1486
|
+
label: "Center focus",
|
|
1487
|
+
value: "center"
|
|
1488
|
+
},
|
|
1489
|
+
{
|
|
1490
|
+
auto: !0,
|
|
1491
|
+
label: "Optical focus",
|
|
1492
|
+
value: "Optical"
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
auto: !0,
|
|
1496
|
+
label: "Google AI",
|
|
1497
|
+
value: "GoogleAI"
|
|
1498
|
+
},
|
|
1499
|
+
{
|
|
1500
|
+
auto: !0,
|
|
1501
|
+
label: "Smart Swatch",
|
|
1502
|
+
value: "SmartSwatch"
|
|
1503
|
+
}
|
|
1504
|
+
], this.extensions = [], this.proxies = void 0, this.forCropper = void 0, this.useSession = "", this.transformations = [], this.selectedProxy = "", this.defaultProxy = "", this.useCustomExtension = !1, this.noMetadata = !1, this.noFormat = !1, this.noCrop = !1, this.noResize = !1, this.noRotate = !1, this.lastImageSize = {
|
|
1505
|
+
height: 0,
|
|
1506
|
+
width: 0
|
|
1507
|
+
}, this.hideHeader = !1, this.canReset = !1, this.queryElement = null, this.activeSetting = "cx-asset-link-format-proxy", this.selectedFormat = void 0, this.resizeSize = {
|
|
1508
|
+
height: 0,
|
|
1509
|
+
keepAspectRatio: !0,
|
|
1510
|
+
ratioHeight: 1,
|
|
1511
|
+
ratioWidth: 1,
|
|
1512
|
+
unit: o.Pixel,
|
|
1513
|
+
width: 0
|
|
1514
|
+
}, this.cropSize = {
|
|
1515
|
+
cropMode: "free",
|
|
1516
|
+
focusMode: "manual",
|
|
1517
|
+
height: 0,
|
|
1518
|
+
keepAspectRatio: !0,
|
|
1519
|
+
percentageHeight: 0,
|
|
1520
|
+
percentageWidth: 0,
|
|
1521
|
+
ratioHeight: 1,
|
|
1522
|
+
ratioWidth: 1,
|
|
1523
|
+
unit: o.Pixel,
|
|
1524
|
+
width: 0,
|
|
1525
|
+
x: 0,
|
|
1526
|
+
y: 0
|
|
1527
|
+
}, this.rotation = 0, this.defaultSize = {
|
|
1528
|
+
height: 0,
|
|
1529
|
+
width: 0
|
|
1530
|
+
}, this.cropperElement = null, this.parameters = [], this.loading = !1, this.lastAction = void 0, this.frozenIndex = void 0, this.preResetTransformations = void 0, this.apiGetTransformAssetLink = oe, this.apiGetCropFocusMode = he, this.onCropComplete = this.onCropComplete.bind(this), this.onCropDragStart = this.onCropDragStart.bind(this);
|
|
1531
|
+
}
|
|
1532
|
+
/** True when there are transformations beyond the frozen index (i.e. user has added new ones). */
|
|
1533
|
+
get hasUnfrozenTransformations() {
|
|
1534
|
+
return !(this.transformations.length === 0 || this.frozenIndex !== void 0 && this.frozenIndex >= this.transformations.length - 1);
|
|
1535
|
+
}
|
|
1536
|
+
/**
|
|
1537
|
+
* Checks if the crop apply button should be disabled.
|
|
1538
|
+
* This is determined by comparing the current crop size with the last crop size.
|
|
1539
|
+
* If the current crop size is equal to the last crop size, the button is disabled.
|
|
1540
|
+
* @return {boolean} - Returns true if the crop apply button should be disabled, false otherwise.
|
|
1541
|
+
*/
|
|
1542
|
+
get disabledCropApply() {
|
|
1543
|
+
const t = [
|
|
1544
|
+
"height",
|
|
1545
|
+
"percentageHeight",
|
|
1546
|
+
"percentageWidth",
|
|
1547
|
+
"unit",
|
|
1548
|
+
"width",
|
|
1549
|
+
"x",
|
|
1550
|
+
"y"
|
|
1551
|
+
];
|
|
1552
|
+
for (const e of t)
|
|
1553
|
+
if (this.cropSize[e] !== this.lastCropSize[this.cropSize.unit][e])
|
|
1554
|
+
return !1;
|
|
1555
|
+
return !0;
|
|
1556
|
+
}
|
|
1557
|
+
/**
|
|
1558
|
+
* Returns the list of formats available for the asset link.
|
|
1559
|
+
* This is derived from the `proxies` property, filtering out any proxies that have a `cdnName`.
|
|
1560
|
+
*/
|
|
1561
|
+
get formats() {
|
|
1562
|
+
return this.proxies?.filter((t) => !t.cdnName) || [];
|
|
1563
|
+
}
|
|
1564
|
+
get imageSize() {
|
|
1565
|
+
return {
|
|
1566
|
+
height: this.selectedFormat?.height ?? 0,
|
|
1567
|
+
width: this.selectedFormat?.width ?? 0
|
|
1568
|
+
};
|
|
1569
|
+
}
|
|
1570
|
+
/**
|
|
1571
|
+
* Returns the last crop size based on the transformations applied to the asset link.
|
|
1572
|
+
* This is calculated by iterating through the transformations and applying the last crop, resize, or rotate transformation to the default size of the asset.
|
|
1573
|
+
* It returns an object with the last crop size in both pixel and aspect ratio units.
|
|
1574
|
+
*/
|
|
1575
|
+
get lastCropSize() {
|
|
1576
|
+
const t = At(
|
|
1577
|
+
this.lastImageSize.width,
|
|
1578
|
+
this.lastImageSize.height
|
|
1579
|
+
);
|
|
1580
|
+
return {
|
|
1581
|
+
[o.AspectRatio]: {
|
|
1582
|
+
height: t.height,
|
|
1583
|
+
percentageHeight: 100,
|
|
1584
|
+
percentageWidth: 100,
|
|
1585
|
+
unit: o.AspectRatio,
|
|
1586
|
+
width: t.width,
|
|
1587
|
+
x: 0,
|
|
1588
|
+
y: 0
|
|
1589
|
+
},
|
|
1590
|
+
[o.Pixel]: {
|
|
1591
|
+
height: this.lastImageSize.height,
|
|
1592
|
+
percentageHeight: 100,
|
|
1593
|
+
percentageWidth: 100,
|
|
1594
|
+
unit: o.Pixel,
|
|
1595
|
+
width: this.lastImageSize.width,
|
|
1596
|
+
x: 0,
|
|
1597
|
+
y: 0
|
|
1598
|
+
}
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1601
|
+
/**
|
|
1602
|
+
* Returns the last resize size based on the transformations applied to the asset link.
|
|
1603
|
+
* This is calculated by iterating through the transformations and applying the last crop, resize, or rotate transformation to the default size of the asset.
|
|
1604
|
+
* It returns an object with the last resize size in both pixel and aspect ratio units.
|
|
1605
|
+
*/
|
|
1606
|
+
get lastResizeSize() {
|
|
1607
|
+
const t = At(
|
|
1608
|
+
this.lastImageSize.width,
|
|
1609
|
+
this.lastImageSize.height
|
|
1610
|
+
);
|
|
1611
|
+
return {
|
|
1612
|
+
[o.AspectRatio]: {
|
|
1613
|
+
height: t.height,
|
|
1614
|
+
unit: o.AspectRatio,
|
|
1615
|
+
width: t.width
|
|
1616
|
+
},
|
|
1617
|
+
[o.Pixel]: {
|
|
1618
|
+
height: this.lastImageSize.height,
|
|
1619
|
+
unit: o.Pixel,
|
|
1620
|
+
width: this.lastImageSize.width
|
|
1621
|
+
}
|
|
1622
|
+
};
|
|
1623
|
+
}
|
|
1624
|
+
/**
|
|
1625
|
+
* Returns the transformation string for the asset link.
|
|
1626
|
+
*/
|
|
1627
|
+
get transformationString() {
|
|
1628
|
+
return et({
|
|
1629
|
+
asset: this.asset,
|
|
1630
|
+
baseUrl: "",
|
|
1631
|
+
parameters: this.parameters,
|
|
1632
|
+
transformations: this.transformations,
|
|
1633
|
+
useSession: this.useSession
|
|
1634
|
+
}).replace(/\/t\//g, "");
|
|
1635
|
+
}
|
|
1636
|
+
runConnectedCallback() {
|
|
1637
|
+
this.hasUpdated && (this.handleCropperSelectorChange(), this.cropperElement && (this.cropperElement.addEventListener(
|
|
1638
|
+
"cx-cropper-crop-complete",
|
|
1639
|
+
this.onCropComplete
|
|
1640
|
+
), this.cropperElement.addEventListener(
|
|
1641
|
+
"cx-cropper-crop-drag-start",
|
|
1642
|
+
this.onCropDragStart
|
|
1643
|
+
)));
|
|
1644
|
+
}
|
|
1645
|
+
disconnectedCallback() {
|
|
1646
|
+
super.disconnectedCallback(), this.cropperElement && (this.cropperElement.removeEventListener(
|
|
1647
|
+
"cx-cropper-crop-complete",
|
|
1648
|
+
this.onCropComplete
|
|
1649
|
+
), this.cropperElement.removeEventListener(
|
|
1650
|
+
"cx-cropper-crop-drag-start",
|
|
1651
|
+
this.onCropDragStart
|
|
1652
|
+
));
|
|
1653
|
+
}
|
|
1654
|
+
updated(t) {
|
|
1655
|
+
if ((t.has("forCropper") || t.has("queryElement")) && this.handleCropperSelectorChange(), t.has("asset") && this.handleAssetChange(), t.has("proxies") && this.handleProxiesChange(), t.has("activeSetting") && this.handleActiveSettingChange(), t.has("selectedFormat") && this.handleSelectedFormatChange(), t.has("resizeSize") && this.handleResizeSizeChange(), t.has("cropSize") && this.handleCropSizeChange(), t.has("rotation") && this.handleRotationChange(), t.has("cropperElement") && this.handleCropperElementChange(), t.has("selectedFormat")) {
|
|
1656
|
+
if (!this.asset || !this.selectedFormat || this.selectedFormat.extension === t.get("selectedFormat")?.extension)
|
|
1657
|
+
return;
|
|
1658
|
+
const e = this.proxies?.find(
|
|
1659
|
+
(s) => s.id === this.selectedProxy
|
|
1660
|
+
);
|
|
1661
|
+
this.loading = !0, this.apiGetTransformAssetLink({
|
|
1662
|
+
assetId: this.asset.id,
|
|
1663
|
+
extension: this.asset.extension,
|
|
1664
|
+
format: e?.proxyName ?? "",
|
|
1665
|
+
siteUrl: this.baseUrl,
|
|
1666
|
+
token: this.token,
|
|
1667
|
+
transformations: this.transformationString
|
|
1668
|
+
}).then((s) => {
|
|
1669
|
+
this.loading = !1, !(!s?.relativePath || !this.selectedFormat) && (this.lastAction === c.Rotate && (this.rotation = 0), this.lastAction = void 0, this.lastImageSize = {
|
|
1670
|
+
height: s.height,
|
|
1671
|
+
width: s.width
|
|
1672
|
+
}, this.selectedFormat = {
|
|
1673
|
+
...this.selectedFormat,
|
|
1674
|
+
height: s.height,
|
|
1675
|
+
url: this.baseUrl && this.baseUrl.length > 0 ? `${this.baseUrl}/${s.relativePath}` : s.relativePath,
|
|
1676
|
+
width: s.width
|
|
1677
|
+
/**
|
|
1678
|
+
* For local development uses the base URL to construct the full URL.
|
|
1679
|
+
* url: `${this.baseUrl}/${response.relativePath}`,
|
|
1680
|
+
*/
|
|
1681
|
+
});
|
|
1682
|
+
});
|
|
1683
|
+
const i = et({
|
|
1684
|
+
asset: this.asset,
|
|
1685
|
+
baseUrl: "",
|
|
1686
|
+
extension: this.selectedFormat.extension,
|
|
1687
|
+
parameters: this.parameters,
|
|
1688
|
+
transformations: this.transformations,
|
|
1689
|
+
useSession: this.useSession
|
|
1690
|
+
});
|
|
1691
|
+
this.emit("cx-asset-link-format-change", {
|
|
1692
|
+
detail: i
|
|
1693
|
+
});
|
|
1694
|
+
}
|
|
1695
|
+
}
|
|
1696
|
+
getCropSize() {
|
|
1697
|
+
return this.cropSize;
|
|
1698
|
+
}
|
|
1699
|
+
setActiveSetting(t) {
|
|
1700
|
+
this.activeSetting = t;
|
|
1701
|
+
}
|
|
1702
|
+
freezeTransformations() {
|
|
1703
|
+
this.frozenIndex = this.transformations.length - 1;
|
|
1704
|
+
}
|
|
1705
|
+
upsertTransformation(t) {
|
|
1706
|
+
const e = this.transformations.findIndex((i) => i.key === t.key);
|
|
1707
|
+
if (e >= 0) {
|
|
1708
|
+
const i = [...this.transformations];
|
|
1709
|
+
i[e] = t, this.transformations = i;
|
|
1710
|
+
} else
|
|
1711
|
+
this.transformations = [...this.transformations, t];
|
|
1712
|
+
}
|
|
1713
|
+
async handleTransformationsChange() {
|
|
1714
|
+
if (await this.updateComplete, !this.asset) {
|
|
1715
|
+
this.emit("cx-asset-link-format-change", {
|
|
1716
|
+
detail: et({
|
|
1717
|
+
asset: this.asset,
|
|
1718
|
+
baseUrl: "",
|
|
1719
|
+
options: {
|
|
1720
|
+
omitZeroXY: !0
|
|
1721
|
+
},
|
|
1722
|
+
parameters: this.parameters,
|
|
1723
|
+
transformations: this.transformations,
|
|
1724
|
+
useSession: this.useSession
|
|
1725
|
+
}).replace(/\/t\//g, "")
|
|
1726
|
+
});
|
|
1727
|
+
const n = this.transformations.findLast(
|
|
1728
|
+
(f) => f.key === c.Crop && f.value.width && f.value.height
|
|
1729
|
+
);
|
|
1730
|
+
if (n) {
|
|
1731
|
+
const { focusMode: f, height: A, unit: $, width: m, x: R = 0, y: Q = 0 } = n.value;
|
|
1732
|
+
this.cropSize = {
|
|
1733
|
+
...this.cropSize,
|
|
1734
|
+
cropMode: "free",
|
|
1735
|
+
focusMode: f ?? "manual",
|
|
1736
|
+
height: A,
|
|
1737
|
+
percentageHeight: 100,
|
|
1738
|
+
percentageWidth: 100,
|
|
1739
|
+
unit: $ ?? o.Pixel,
|
|
1740
|
+
width: m,
|
|
1741
|
+
x: R,
|
|
1742
|
+
y: Q
|
|
1743
|
+
};
|
|
1744
|
+
} else
|
|
1745
|
+
this.cropSize = {
|
|
1746
|
+
...this.cropSize,
|
|
1747
|
+
cropMode: "free",
|
|
1748
|
+
focusMode: "manual",
|
|
1749
|
+
height: 0,
|
|
1750
|
+
percentageHeight: 0,
|
|
1751
|
+
percentageWidth: 0,
|
|
1752
|
+
unit: o.Pixel,
|
|
1753
|
+
width: 0,
|
|
1754
|
+
x: 0,
|
|
1755
|
+
y: 0
|
|
1756
|
+
};
|
|
1757
|
+
const r = this.transformations.findLast(
|
|
1758
|
+
(f) => f.key === c.Resize && (f.value.width || f.value.height)
|
|
1759
|
+
);
|
|
1760
|
+
if (r) {
|
|
1761
|
+
const { height: f = 0, unit: A, width: $ = 0 } = r.value;
|
|
1762
|
+
this.resizeSize = {
|
|
1763
|
+
...this.resizeSize,
|
|
1764
|
+
height: f,
|
|
1765
|
+
unit: A ?? o.Pixel,
|
|
1766
|
+
width: $
|
|
1767
|
+
};
|
|
1768
|
+
} else
|
|
1769
|
+
this.resizeSize = {
|
|
1770
|
+
...this.resizeSize,
|
|
1771
|
+
height: 0,
|
|
1772
|
+
unit: o.Pixel,
|
|
1773
|
+
width: 0
|
|
1774
|
+
};
|
|
1775
|
+
const l = this.transformations.findLast(
|
|
1776
|
+
(f) => f.key === c.Rotate
|
|
1777
|
+
);
|
|
1778
|
+
this.rotation = l?.value.rotation ?? 0;
|
|
1779
|
+
const u = this.transformations.findLast((f) => f.key === c.Quality)?.value.quality ?? 100, S = this.transformations.some(
|
|
1780
|
+
(f) => f.key === c.Metadata
|
|
1781
|
+
);
|
|
1782
|
+
this.selectedFormat ? this.selectedFormat = { ...this.selectedFormat, keepMetadata: S, quality: u } : this.selectedFormat = {
|
|
1783
|
+
extension: "",
|
|
1784
|
+
height: 0,
|
|
1785
|
+
keepMetadata: S,
|
|
1786
|
+
originalUrl: "",
|
|
1787
|
+
quality: u,
|
|
1788
|
+
rotation: 0,
|
|
1789
|
+
url: "",
|
|
1790
|
+
width: 0,
|
|
1791
|
+
x: 0,
|
|
1792
|
+
y: 0
|
|
1793
|
+
};
|
|
1794
|
+
return;
|
|
1795
|
+
}
|
|
1796
|
+
if (!this.selectedFormat)
|
|
1797
|
+
return;
|
|
1798
|
+
const t = this.proxies?.find(
|
|
1799
|
+
(n) => n.id === this.selectedProxy
|
|
1800
|
+
);
|
|
1801
|
+
this.loading = !0;
|
|
1802
|
+
const e = await this.apiGetTransformAssetLink({
|
|
1803
|
+
assetId: this.asset.id,
|
|
1804
|
+
extension: this.selectedFormat.extension,
|
|
1805
|
+
format: t?.proxyName ?? "",
|
|
1806
|
+
siteUrl: this.baseUrl,
|
|
1807
|
+
token: this.token,
|
|
1808
|
+
transformations: this.transformationString
|
|
1809
|
+
});
|
|
1810
|
+
if (this.loading = !1, !e?.relativePath || !this.selectedFormat)
|
|
1811
|
+
return;
|
|
1812
|
+
this.lastImageSize = {
|
|
1813
|
+
height: e.height,
|
|
1814
|
+
width: e.width
|
|
1815
|
+
}, this.resizeSize = {
|
|
1816
|
+
height: e.height,
|
|
1817
|
+
keepAspectRatio: !0,
|
|
1818
|
+
ratioHeight: 1,
|
|
1819
|
+
ratioWidth: 1,
|
|
1820
|
+
unit: o.Pixel,
|
|
1821
|
+
width: e.width
|
|
1822
|
+
}, this.cropSize = {
|
|
1823
|
+
cropMode: "free",
|
|
1824
|
+
focusMode: "manual",
|
|
1825
|
+
height: e.height,
|
|
1826
|
+
keepAspectRatio: this.cropSize.keepAspectRatio,
|
|
1827
|
+
percentageHeight: 100,
|
|
1828
|
+
percentageWidth: 100,
|
|
1829
|
+
ratioHeight: 1,
|
|
1830
|
+
ratioWidth: 1,
|
|
1831
|
+
unit: o.Pixel,
|
|
1832
|
+
width: e.width,
|
|
1833
|
+
x: 0,
|
|
1834
|
+
y: 0
|
|
1835
|
+
}, this.lastAction === c.Rotate && (this.rotation = 0), this.lastAction = void 0;
|
|
1836
|
+
const i = this.transformations.some(
|
|
1837
|
+
(n) => n.key === c.Metadata
|
|
1838
|
+
), s = this.transformations.findLast(
|
|
1839
|
+
(n) => n.key === c.Quality
|
|
1840
|
+
);
|
|
1841
|
+
this.selectedFormat = {
|
|
1842
|
+
...this.selectedFormat,
|
|
1843
|
+
height: e.height,
|
|
1844
|
+
keepMetadata: i,
|
|
1845
|
+
quality: s?.value?.quality ?? this.selectedFormat.quality,
|
|
1846
|
+
url: this.baseUrl && this.baseUrl.length > 0 ? `${this.baseUrl}/${e.relativePath}` : e.relativePath,
|
|
1847
|
+
width: e.width
|
|
1848
|
+
/**
|
|
1849
|
+
* For local development uses the base URL to construct the full URL.
|
|
1850
|
+
* url: `${this.baseUrl}/${response.relativePath}`,
|
|
1851
|
+
*/
|
|
1852
|
+
};
|
|
1853
|
+
const a = et({
|
|
1854
|
+
asset: this.asset,
|
|
1855
|
+
baseUrl: "",
|
|
1856
|
+
extension: this.selectedFormat.extension,
|
|
1857
|
+
parameters: this.parameters,
|
|
1858
|
+
transformations: this.transformations,
|
|
1859
|
+
useSession: this.useSession
|
|
1860
|
+
});
|
|
1861
|
+
this.emit("cx-asset-link-format-change", {
|
|
1862
|
+
detail: a
|
|
1863
|
+
});
|
|
1864
|
+
}
|
|
1865
|
+
handleCropperElementChange() {
|
|
1866
|
+
this.cropperElement && (this.cropperElement.resizer = this.resizeSize, this.cropperElement.cropper = this.cropSize, this.cropperElement.rotation = this.rotation, this.cropperElement.disabled = this.activeSetting !== "cx-asset-link-format-crop", this.cropperElement.addEventListener(
|
|
1867
|
+
"cx-cropper-crop-complete",
|
|
1868
|
+
this.onCropComplete
|
|
1869
|
+
), this.cropperElement.addEventListener(
|
|
1870
|
+
"cx-cropper-crop-drag-start",
|
|
1871
|
+
this.onCropDragStart
|
|
1872
|
+
), this.cropperElement.loadable = !0);
|
|
1873
|
+
}
|
|
1874
|
+
handleCropperSelectorChange() {
|
|
1875
|
+
this.forCropper && (this.queryElement ? this.cropperElement = this.queryElement.querySelector(`#${this.forCropper}`) : this.cropperElement = document.getElementById(this.forCropper));
|
|
1876
|
+
}
|
|
1877
|
+
handleAssetChange() {
|
|
1878
|
+
if (!this.asset)
|
|
1879
|
+
return;
|
|
1880
|
+
this.freezeTransformations(), this.asset.width && this.asset.height && (this.defaultSize = {
|
|
1881
|
+
height: Number.parseInt(this.asset.height, 10),
|
|
1882
|
+
width: Number.parseInt(this.asset.width, 10)
|
|
1883
|
+
});
|
|
1884
|
+
const t = this.transformations.findLast(
|
|
1885
|
+
(e) => e.key === c.Quality
|
|
1886
|
+
);
|
|
1887
|
+
this.selectedFormat = {
|
|
1888
|
+
extension: this.asset.extension,
|
|
1889
|
+
height: this.defaultSize.height,
|
|
1890
|
+
keepMetadata: !1,
|
|
1891
|
+
originalUrl: this.asset.originalUrl,
|
|
1892
|
+
quality: t?.value?.quality || 100,
|
|
1893
|
+
rotation: 0,
|
|
1894
|
+
url: this.asset.imageUrl,
|
|
1895
|
+
width: this.defaultSize.width,
|
|
1896
|
+
x: 0,
|
|
1897
|
+
y: 0
|
|
1898
|
+
}, this.resizeSize = {
|
|
1899
|
+
...this.resizeSize,
|
|
1900
|
+
height: this.defaultSize.height,
|
|
1901
|
+
width: this.defaultSize.width
|
|
1902
|
+
}, this.cropSize = {
|
|
1903
|
+
cropMode: "free",
|
|
1904
|
+
focusMode: "manual",
|
|
1905
|
+
height: this.defaultSize.height,
|
|
1906
|
+
keepAspectRatio: !0,
|
|
1907
|
+
percentageHeight: 100,
|
|
1908
|
+
percentageWidth: 100,
|
|
1909
|
+
ratioHeight: 1,
|
|
1910
|
+
ratioWidth: 1,
|
|
1911
|
+
unit: o.Pixel,
|
|
1912
|
+
width: this.defaultSize.width,
|
|
1913
|
+
x: 0,
|
|
1914
|
+
y: 0
|
|
1915
|
+
}, this.selectedProxy || (this.selectedProxy = this.proxies && this.proxies.length > 0 ? this.proxies[0].id : "");
|
|
1916
|
+
}
|
|
1917
|
+
handleProxiesChange() {
|
|
1918
|
+
!this.proxies || this.proxies.length === 0 || (!this.selectedProxy || !this.proxies.some((t) => t.id === this.selectedProxy)) && (this.selectedProxy = this.proxies[0].id);
|
|
1919
|
+
}
|
|
1920
|
+
async handleSelectedProxyChange(t) {
|
|
1921
|
+
if (!this.asset || !this.selectedProxy)
|
|
1922
|
+
return;
|
|
1923
|
+
const e = this.proxies?.find(
|
|
1924
|
+
(s) => s.id === this.selectedProxy
|
|
1925
|
+
);
|
|
1926
|
+
if (!e || !this.selectedFormat)
|
|
1927
|
+
return;
|
|
1928
|
+
e.proxyName === "TRX" && (e.formatHeight = Number(this.asset.height), e.formatWidth = Number(this.asset.width));
|
|
1929
|
+
const i = this.proxies?.find((s) => s.id === t);
|
|
1930
|
+
i && (this.asset && i.proxyName === "TRX" && (i.formatHeight = Number(this.asset.height), i.formatWidth = Number(this.asset.width)), this.transformations = this.transformations.map((s) => {
|
|
1931
|
+
if (s.key === c.Crop) {
|
|
1932
|
+
const a = s.value, n = a.width / i.formatWidth * e.formatWidth, r = a.height / i.formatHeight * e.formatHeight, l = a.x / i.formatWidth * e.formatWidth, u = a.y / i.formatHeight * e.formatHeight;
|
|
1933
|
+
return {
|
|
1934
|
+
...s,
|
|
1935
|
+
value: {
|
|
1936
|
+
...s.value,
|
|
1937
|
+
height: r,
|
|
1938
|
+
width: n,
|
|
1939
|
+
x: l,
|
|
1940
|
+
y: u
|
|
1941
|
+
}
|
|
1942
|
+
};
|
|
1943
|
+
}
|
|
1944
|
+
if (s.key === c.Resize) {
|
|
1945
|
+
const a = s.value, n = a.width / i.formatWidth * e.formatWidth, r = a.height / i.formatHeight * e.formatHeight;
|
|
1946
|
+
return {
|
|
1947
|
+
...s,
|
|
1948
|
+
value: {
|
|
1949
|
+
height: r,
|
|
1950
|
+
width: n
|
|
1951
|
+
}
|
|
1952
|
+
};
|
|
1953
|
+
}
|
|
1954
|
+
return s;
|
|
1955
|
+
})), this.defaultSize = {
|
|
1956
|
+
height: e.formatHeight || this.defaultSize.height,
|
|
1957
|
+
width: e.formatWidth || this.defaultSize.width
|
|
1958
|
+
}, this.selectedFormat = {
|
|
1959
|
+
...this.selectedFormat,
|
|
1960
|
+
height: this.defaultSize.height,
|
|
1961
|
+
width: this.defaultSize.width
|
|
1962
|
+
}, await this.updateComplete, this.cropSize = {
|
|
1963
|
+
cropMode: "free",
|
|
1964
|
+
focusMode: "manual",
|
|
1965
|
+
height: this.lastCropSize[o.Pixel].height,
|
|
1966
|
+
keepAspectRatio: !0,
|
|
1967
|
+
percentageHeight: 100,
|
|
1968
|
+
percentageWidth: 100,
|
|
1969
|
+
ratioHeight: 1,
|
|
1970
|
+
ratioWidth: 1,
|
|
1971
|
+
unit: o.Pixel,
|
|
1972
|
+
width: this.lastCropSize[o.Pixel].width,
|
|
1973
|
+
x: 0,
|
|
1974
|
+
y: 0
|
|
1975
|
+
}, this.resizeSize = {
|
|
1976
|
+
height: this.lastResizeSize[o.Pixel].height,
|
|
1977
|
+
keepAspectRatio: !0,
|
|
1978
|
+
ratioHeight: 1,
|
|
1979
|
+
ratioWidth: 1,
|
|
1980
|
+
unit: o.Pixel,
|
|
1981
|
+
width: this.lastResizeSize[o.Pixel].width
|
|
1982
|
+
};
|
|
1983
|
+
}
|
|
1984
|
+
handleLoadingChange() {
|
|
1985
|
+
this.cropperElement && (this.cropperElement.loading = this.loading);
|
|
1986
|
+
}
|
|
1987
|
+
handleSelectedFormatChange() {
|
|
1988
|
+
!this.cropperElement || !this.selectedFormat?.url || (this.cropperElement.image = this.selectedFormat);
|
|
1989
|
+
}
|
|
1990
|
+
handleResizeSizeChange() {
|
|
1991
|
+
this.cropperElement && (this.cropperElement.resizer = this.resizeSize);
|
|
1992
|
+
}
|
|
1993
|
+
handleCropSizeChange() {
|
|
1994
|
+
this.cropperElement && (this.cropperElement.cropper = this.cropSize);
|
|
1995
|
+
}
|
|
1996
|
+
handleRotationChange() {
|
|
1997
|
+
this.cropperElement && (this.cropperElement.rotation = this.rotation);
|
|
1998
|
+
}
|
|
1999
|
+
handleActiveSettingChange() {
|
|
2000
|
+
this.cropperElement && (this.resizeSize = {
|
|
2001
|
+
height: this.lastResizeSize[o.Pixel].height,
|
|
2002
|
+
keepAspectRatio: !0,
|
|
2003
|
+
ratioHeight: 1,
|
|
2004
|
+
ratioWidth: 1,
|
|
2005
|
+
unit: o.Pixel,
|
|
2006
|
+
width: this.lastResizeSize[o.Pixel].width
|
|
2007
|
+
}, this.cropperElement.disabled = this.activeSetting !== "cx-asset-link-format-crop");
|
|
2008
|
+
}
|
|
2009
|
+
async handleRequestAutoCropSuggestion({
|
|
2010
|
+
cropMode: t,
|
|
2011
|
+
focusMode: e,
|
|
2012
|
+
height: i,
|
|
2013
|
+
keepAspectRatio: s,
|
|
2014
|
+
percentageHeight: a,
|
|
2015
|
+
percentageWidth: n,
|
|
2016
|
+
ratioHeight: r,
|
|
2017
|
+
ratioWidth: l,
|
|
2018
|
+
unit: u,
|
|
2019
|
+
useCropMode: S,
|
|
2020
|
+
width: f
|
|
2021
|
+
}) {
|
|
2022
|
+
if (!this.selectedFormat?.url || e === "manual")
|
|
2023
|
+
return;
|
|
2024
|
+
this.loading = !0, this.lastAction = c.Crop;
|
|
2025
|
+
const A = await this.apiGetCropFocusMode({
|
|
2026
|
+
autoCropMode: e,
|
|
2027
|
+
cropHeight: i,
|
|
2028
|
+
cropWidth: f,
|
|
2029
|
+
imageUrl: this.selectedFormat.url
|
|
2030
|
+
});
|
|
2031
|
+
if (A) {
|
|
2032
|
+
let $ = a, m = n;
|
|
2033
|
+
i || ($ = A.height * 100 / this.selectedFormat.height), f || (m = A.width * 100 / this.selectedFormat.width), this.cropSize = {
|
|
2034
|
+
...this.cropSize,
|
|
2035
|
+
height: A.height,
|
|
2036
|
+
percentageHeight: $ ?? this.cropSize.percentageHeight,
|
|
2037
|
+
percentageWidth: m ?? this.cropSize.percentageWidth,
|
|
2038
|
+
width: A.width,
|
|
2039
|
+
x: A.x * 100 / this.selectedFormat.width,
|
|
2040
|
+
y: A.y * 100 / this.selectedFormat.height,
|
|
2041
|
+
...S ? {
|
|
2042
|
+
cropMode: e,
|
|
2043
|
+
focusMode: "manual",
|
|
2044
|
+
keepAspectRatio: !1
|
|
2045
|
+
} : {
|
|
2046
|
+
cropMode: t ?? this.cropSize.cropMode,
|
|
2047
|
+
focusMode: e
|
|
2048
|
+
},
|
|
2049
|
+
keepAspectRatio: s ?? this.cropSize.keepAspectRatio,
|
|
2050
|
+
ratioHeight: r ?? this.cropSize.ratioHeight,
|
|
2051
|
+
ratioWidth: l ?? this.cropSize.ratioWidth,
|
|
2052
|
+
unit: u ?? this.cropSize.unit
|
|
2053
|
+
};
|
|
2054
|
+
}
|
|
2055
|
+
this.loading = !1, this.lastAction = void 0;
|
|
2056
|
+
}
|
|
2057
|
+
async onCropComplete(t) {
|
|
2058
|
+
const { croppedArea: e } = t.detail, {
|
|
2059
|
+
height: i,
|
|
2060
|
+
width: s,
|
|
2061
|
+
x: a,
|
|
2062
|
+
y: n
|
|
2063
|
+
} = e;
|
|
2064
|
+
if (s === 0 || i === 0)
|
|
2065
|
+
return;
|
|
2066
|
+
const r = this.cropSize.percentageWidth !== s, l = this.cropSize.percentageHeight !== i;
|
|
2067
|
+
let u = this.cropSize.height, S = this.cropSize.width;
|
|
2068
|
+
r && (S = Math.round(s * this.selectedFormat.width / 100)), l && (u = Math.round(
|
|
2069
|
+
i * this.selectedFormat.height / 100
|
|
2070
|
+
));
|
|
2071
|
+
const f = this.cropSize.focusMode;
|
|
2072
|
+
this.focusModes.find(
|
|
2073
|
+
($) => $.value === f
|
|
2074
|
+
)?.auto && this.selectedFormat?.url && this.cropperElement ? await this.handleRequestAutoCropSuggestion({
|
|
2075
|
+
focusMode: f,
|
|
2076
|
+
height: u,
|
|
2077
|
+
percentageHeight: i,
|
|
2078
|
+
percentageWidth: s,
|
|
2079
|
+
width: S
|
|
2080
|
+
}) : this.cropSize = {
|
|
2081
|
+
...this.cropSize,
|
|
2082
|
+
height: u,
|
|
2083
|
+
percentageHeight: i,
|
|
2084
|
+
percentageWidth: s,
|
|
2085
|
+
width: S,
|
|
2086
|
+
x: a,
|
|
2087
|
+
y: n
|
|
2088
|
+
};
|
|
2089
|
+
}
|
|
2090
|
+
onCropDragStart() {
|
|
2091
|
+
let t = this.cropSize.cropMode;
|
|
2092
|
+
const e = this.cropModes.find(
|
|
2093
|
+
(i) => i.value === t
|
|
2094
|
+
)?.auto;
|
|
2095
|
+
(this.cropSize.focusMode !== "manual" || e) && (e && (t = "free"), this.cropSize = {
|
|
2096
|
+
...this.cropSize,
|
|
2097
|
+
cropMode: t,
|
|
2098
|
+
focusMode: "manual"
|
|
2099
|
+
});
|
|
2100
|
+
}
|
|
2101
|
+
onDetailsShow(t) {
|
|
2102
|
+
const e = t.target;
|
|
2103
|
+
e.shadowRoot?.querySelector(".details") && (this.activeSetting = e.localName);
|
|
2104
|
+
}
|
|
2105
|
+
onDetailsHide(t) {
|
|
2106
|
+
this.activeSetting === t.target.localName && (this.activeSetting = "");
|
|
2107
|
+
}
|
|
2108
|
+
onProxyChange(t) {
|
|
2109
|
+
const e = t.detail;
|
|
2110
|
+
this.lastAction = c.Proxy, this.selectedProxy = e.id;
|
|
2111
|
+
}
|
|
2112
|
+
async onCropModeChange(t) {
|
|
2113
|
+
const { mode: e } = t.detail;
|
|
2114
|
+
if (this.cropModes.find((s) => s.value === e)?.auto)
|
|
2115
|
+
await this.handleRequestAutoCropSuggestion({
|
|
2116
|
+
focusMode: e,
|
|
2117
|
+
useCropMode: !0
|
|
2118
|
+
});
|
|
2119
|
+
else {
|
|
2120
|
+
const s = this.focusModes.find(
|
|
2121
|
+
(u) => u.value === this.cropSize.focusMode
|
|
2122
|
+
)?.auto;
|
|
2123
|
+
let a = this.cropSize.keepAspectRatio, n = this.cropSize.focusMode, r = this.cropSize.x, l = this.cropSize.y;
|
|
2124
|
+
e === "free" ? (a = !1, n = "manual") : this.cropSize.unit === o.Pixel && !s && (r = 0, l = 0), s ? await this.handleRequestAutoCropSuggestion({
|
|
2125
|
+
cropMode: e,
|
|
2126
|
+
focusMode: n,
|
|
2127
|
+
height: this.cropSize.height,
|
|
2128
|
+
keepAspectRatio: a,
|
|
2129
|
+
width: this.cropSize.width
|
|
2130
|
+
}) : this.cropSize = {
|
|
2131
|
+
...this.cropSize,
|
|
2132
|
+
cropMode: e,
|
|
2133
|
+
focusMode: n,
|
|
2134
|
+
keepAspectRatio: a,
|
|
2135
|
+
x: r,
|
|
2136
|
+
y: l
|
|
2137
|
+
}, this.asset || (e && e !== "free" ? this.upsertTransformation({
|
|
2138
|
+
key: c.Crop,
|
|
2139
|
+
value: {
|
|
2140
|
+
mode: e
|
|
2141
|
+
}
|
|
2142
|
+
}) : this.transformations = this.transformations.filter(
|
|
2143
|
+
(u) => u.key !== c.Crop
|
|
2144
|
+
));
|
|
2145
|
+
}
|
|
2146
|
+
}
|
|
2147
|
+
onCropFocusModeChange(t) {
|
|
2148
|
+
const { mode: e } = t.detail, i = this.focusModes.find((s) => s.value === e)?.auto;
|
|
2149
|
+
if (i && this.selectedFormat?.url ? this.handleRequestAutoCropSuggestion({
|
|
2150
|
+
focusMode: e,
|
|
2151
|
+
height: this.cropSize.height,
|
|
2152
|
+
width: this.cropSize.width
|
|
2153
|
+
}) : this.cropSize = {
|
|
2154
|
+
...this.cropSize,
|
|
2155
|
+
focusMode: e
|
|
2156
|
+
}, !this.asset) {
|
|
2157
|
+
const { height: s, unit: a, width: n, x: r, y: l } = this.cropSize;
|
|
2158
|
+
(s || n) && this.upsertTransformation({
|
|
2159
|
+
key: c.Crop,
|
|
2160
|
+
value: {
|
|
2161
|
+
focusMode: e,
|
|
2162
|
+
height: s,
|
|
2163
|
+
isFocusModeAuto: i ?? !1,
|
|
2164
|
+
unit: a,
|
|
2165
|
+
width: n,
|
|
2166
|
+
x: r,
|
|
2167
|
+
y: l
|
|
2168
|
+
}
|
|
2169
|
+
});
|
|
2170
|
+
}
|
|
2171
|
+
}
|
|
2172
|
+
async onCropChange(t) {
|
|
2173
|
+
const e = this.cropSize.unit;
|
|
2174
|
+
if (t.detail.unit === o.AspectRatio) {
|
|
2175
|
+
const i = t.detail.width / t.detail.height, s = Math.min(
|
|
2176
|
+
Math.max(Math.round(this.cropSize.height * i), 0),
|
|
2177
|
+
this.resizeSize.width
|
|
2178
|
+
), a = Math.min(
|
|
2179
|
+
Math.max(Math.round(s / i), 0),
|
|
2180
|
+
this.resizeSize.height
|
|
2181
|
+
), n = a * 100 / this.selectedFormat.height, r = s * 100 / this.selectedFormat.width;
|
|
2182
|
+
let l = this.cropSize.x, u = this.cropSize.y;
|
|
2183
|
+
l + r > 100 && (l = 100 - r), u + n > 100 && (u = 100 - n);
|
|
2184
|
+
let S = this.cropSize.cropMode;
|
|
2185
|
+
this.cropModes.find(
|
|
2186
|
+
(A) => A.value === S
|
|
2187
|
+
)?.auto && (S = "free"), t.detail.silent ? (this.cropSize.height = a, this.cropSize.keepAspectRatio = t.detail.keepAspectRatio, this.cropSize.percentageHeight = n, this.cropSize.percentageWidth = r, this.cropSize.ratioHeight = t.detail.height, this.cropSize.ratioWidth = t.detail.width, this.cropSize.unit = o.AspectRatio, this.cropSize.width = s) : this.cropSize = {
|
|
2188
|
+
...this.cropSize,
|
|
2189
|
+
cropMode: S,
|
|
2190
|
+
height: a,
|
|
2191
|
+
keepAspectRatio: t.detail.keepAspectRatio,
|
|
2192
|
+
percentageHeight: n,
|
|
2193
|
+
percentageWidth: r,
|
|
2194
|
+
ratioHeight: t.detail.height,
|
|
2195
|
+
ratioWidth: t.detail.width,
|
|
2196
|
+
unit: o.AspectRatio,
|
|
2197
|
+
width: s,
|
|
2198
|
+
x: l,
|
|
2199
|
+
y: u
|
|
2200
|
+
};
|
|
2201
|
+
} else {
|
|
2202
|
+
const i = this.selectedFormat ? t.detail.height * 100 / this.selectedFormat.height : 100, s = this.selectedFormat ? t.detail.width * 100 / this.selectedFormat.width : 100;
|
|
2203
|
+
let a = this.cropSize.x, n = this.cropSize.y;
|
|
2204
|
+
a + s > 100 && (a = 100 - s), n + i > 100 && (n = 100 - i);
|
|
2205
|
+
let r = this.cropSize.cropMode;
|
|
2206
|
+
const l = this.cropModes.find(
|
|
2207
|
+
(u) => u.value === r
|
|
2208
|
+
)?.auto;
|
|
2209
|
+
(t.detail.breakAspectRatio || l) && (r = "free"), t.detail.silent ? (this.cropSize.cropMode = r, this.cropSize.height = t.detail.height, this.cropSize.keepAspectRatio = t.detail.keepAspectRatio, this.cropSize.percentageHeight = i, this.cropSize.percentageWidth = s, this.cropSize.unit = o.Pixel, this.cropSize.width = t.detail.width, this.cropSize.x = a, this.cropSize.y = n) : this.cropSize = {
|
|
2210
|
+
...this.cropSize,
|
|
2211
|
+
cropMode: r,
|
|
2212
|
+
height: t.detail.height,
|
|
2213
|
+
keepAspectRatio: t.detail.keepAspectRatio,
|
|
2214
|
+
percentageHeight: i,
|
|
2215
|
+
percentageWidth: s,
|
|
2216
|
+
unit: o.Pixel,
|
|
2217
|
+
width: t.detail.width,
|
|
2218
|
+
x: a,
|
|
2219
|
+
y: n
|
|
2220
|
+
};
|
|
2221
|
+
}
|
|
2222
|
+
if (e !== this.cropSize.unit && (this.cropSize = {
|
|
2223
|
+
...this.cropSize,
|
|
2224
|
+
cropMode: "free"
|
|
2225
|
+
}, this.onCropChanged()), !this.asset && !t.detail.silent) {
|
|
2226
|
+
const { focusMode: i, height: s, unit: a, width: n, x: r, y: l } = this.cropSize, u = this.focusModes.find(
|
|
2227
|
+
(S) => S.value === i
|
|
2228
|
+
)?.auto ?? !1;
|
|
2229
|
+
(s || n) && this.upsertTransformation({
|
|
2230
|
+
key: c.Crop,
|
|
2231
|
+
value: {
|
|
2232
|
+
focusMode: i,
|
|
2233
|
+
height: s,
|
|
2234
|
+
isFocusModeAuto: u,
|
|
2235
|
+
unit: a,
|
|
2236
|
+
width: n,
|
|
2237
|
+
x: r,
|
|
2238
|
+
y: l
|
|
2239
|
+
}
|
|
2240
|
+
});
|
|
2241
|
+
}
|
|
2242
|
+
}
|
|
2243
|
+
async onCropChanged() {
|
|
2244
|
+
this.focusModes.find(
|
|
2245
|
+
(e) => e.value === this.cropSize.focusMode
|
|
2246
|
+
)?.auto && await this.handleRequestAutoCropSuggestion({
|
|
2247
|
+
focusMode: this.cropSize.focusMode,
|
|
2248
|
+
height: this.cropSize.height,
|
|
2249
|
+
width: this.cropSize.width
|
|
2250
|
+
});
|
|
2251
|
+
}
|
|
2252
|
+
onCropApply(t) {
|
|
2253
|
+
const { height: e, mode: i, unit: s, width: a } = t.detail;
|
|
2254
|
+
if (this.preResetTransformations = void 0, this.lastAction = c.Crop, !this.cropperElement || !this.selectedFormat)
|
|
2255
|
+
return;
|
|
2256
|
+
const n = this.cropSize.focusMode, r = this.focusModes.find(
|
|
2257
|
+
(l) => l.value === n
|
|
2258
|
+
)?.auto ?? !1;
|
|
2259
|
+
if (e && a && s) {
|
|
2260
|
+
let l = a, u = e;
|
|
2261
|
+
if (s === o.AspectRatio && (l = this.cropSize.percentageWidth * this.selectedFormat.width / 100, u = this.cropSize.percentageHeight * this.selectedFormat.height / 100), i)
|
|
2262
|
+
this.transformations = [
|
|
2263
|
+
...this.transformations,
|
|
2264
|
+
{
|
|
2265
|
+
key: c.Crop,
|
|
2266
|
+
value: {
|
|
2267
|
+
focusMode: n,
|
|
2268
|
+
height: u,
|
|
2269
|
+
isFocusModeAuto: r,
|
|
2270
|
+
mode: i,
|
|
2271
|
+
width: l
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
];
|
|
2275
|
+
else {
|
|
2276
|
+
const S = this.cropSize.x / 100 * this.selectedFormat.width, f = this.cropSize.y / 100 * this.selectedFormat.height;
|
|
2277
|
+
this.transformations = [
|
|
2278
|
+
...this.transformations,
|
|
2279
|
+
{
|
|
2280
|
+
key: c.Crop,
|
|
2281
|
+
value: {
|
|
2282
|
+
focusMode: n,
|
|
2283
|
+
height: u,
|
|
2284
|
+
isFocusModeAuto: r,
|
|
2285
|
+
unit: s,
|
|
2286
|
+
width: l,
|
|
2287
|
+
x: S,
|
|
2288
|
+
y: f
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
];
|
|
2292
|
+
}
|
|
2293
|
+
} else i && (this.transformations = [
|
|
2294
|
+
...this.transformations,
|
|
2295
|
+
{
|
|
2296
|
+
key: c.Crop,
|
|
2297
|
+
value: {
|
|
2298
|
+
focusMode: n,
|
|
2299
|
+
isFocusModeAuto: r,
|
|
2300
|
+
mode: i
|
|
2301
|
+
}
|
|
2302
|
+
}
|
|
2303
|
+
]);
|
|
2304
|
+
}
|
|
2305
|
+
onResizeChange(t) {
|
|
2306
|
+
if (t.detail.unit === o.AspectRatio) {
|
|
2307
|
+
const e = t.detail.width / t.detail.height, i = Math.max(
|
|
2308
|
+
Math.round(this.lastResizeSize[o.Pixel].height * e),
|
|
2309
|
+
0
|
|
2310
|
+
), s = Math.max(Math.round(i / e), 0);
|
|
2311
|
+
this.resizeSize = {
|
|
2312
|
+
...this.resizeSize,
|
|
2313
|
+
height: s,
|
|
2314
|
+
keepAspectRatio: t.detail.keepAspectRatio,
|
|
2315
|
+
ratioHeight: t.detail.height,
|
|
2316
|
+
ratioWidth: t.detail.width,
|
|
2317
|
+
unit: t.detail.unit,
|
|
2318
|
+
width: i
|
|
2319
|
+
};
|
|
2320
|
+
} else
|
|
2321
|
+
this.resizeSize = {
|
|
2322
|
+
...this.resizeSize,
|
|
2323
|
+
height: Math.max(t.detail.height, 0),
|
|
2324
|
+
keepAspectRatio: t.detail.keepAspectRatio,
|
|
2325
|
+
unit: t.detail.unit,
|
|
2326
|
+
width: Math.max(t.detail.width, 0)
|
|
2327
|
+
};
|
|
2328
|
+
if (!this.asset) {
|
|
2329
|
+
const { height: e, unit: i, width: s } = this.resizeSize;
|
|
2330
|
+
(e || s) && this.upsertTransformation({
|
|
2331
|
+
key: c.Resize,
|
|
2332
|
+
value: {
|
|
2333
|
+
height: e,
|
|
2334
|
+
unit: i,
|
|
2335
|
+
width: s
|
|
2336
|
+
}
|
|
2337
|
+
});
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
onResizeApply(t) {
|
|
2341
|
+
if (!this.selectedFormat)
|
|
2342
|
+
return;
|
|
2343
|
+
const { height: e, unit: i, width: s } = t.detail;
|
|
2344
|
+
this.preResetTransformations = void 0, this.lastAction = c.Resize;
|
|
2345
|
+
const a = this.selectedFormat.width || this.defaultSize.width, n = this.selectedFormat.height || this.defaultSize.height;
|
|
2346
|
+
let r = s, l = e;
|
|
2347
|
+
this.resizeSize.unit !== i ? (r = a, l = n) : i === o.AspectRatio && (r = Math.round(s / e * n), l = n), this.transformations = [
|
|
2348
|
+
...this.transformations,
|
|
2349
|
+
{
|
|
2350
|
+
key: c.Resize,
|
|
2351
|
+
value: {
|
|
2352
|
+
height: l,
|
|
2353
|
+
unit: i,
|
|
2354
|
+
width: r
|
|
2355
|
+
}
|
|
2356
|
+
}
|
|
2357
|
+
];
|
|
2358
|
+
}
|
|
2359
|
+
onRotationChange(t) {
|
|
2360
|
+
this.rotation = t.detail, this.asset || (this.rotation ? this.upsertTransformation({
|
|
2361
|
+
key: c.Rotate,
|
|
2362
|
+
value: {
|
|
2363
|
+
rotation: this.rotation
|
|
2364
|
+
}
|
|
2365
|
+
}) : this.transformations = this.transformations.filter(
|
|
2366
|
+
(e) => e.key !== c.Rotate
|
|
2367
|
+
));
|
|
2368
|
+
}
|
|
2369
|
+
onRotationApply(t) {
|
|
2370
|
+
if (!this.selectedFormat)
|
|
2371
|
+
return;
|
|
2372
|
+
const e = t.detail;
|
|
2373
|
+
this.preResetTransformations = void 0, this.lastAction = c.Rotate, this.transformations = [
|
|
2374
|
+
...this.transformations,
|
|
2375
|
+
{
|
|
2376
|
+
key: c.Rotate,
|
|
2377
|
+
value: {
|
|
2378
|
+
rotation: e
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
];
|
|
2382
|
+
}
|
|
2383
|
+
onQualityChange(t) {
|
|
2384
|
+
const e = t.detail;
|
|
2385
|
+
this.selectedFormat && (this.selectedFormat.quality = e), this.preResetTransformations = void 0, this.lastAction = c.Quality;
|
|
2386
|
+
const i = {
|
|
2387
|
+
key: c.Quality,
|
|
2388
|
+
value: {
|
|
2389
|
+
quality: e
|
|
2390
|
+
}
|
|
2391
|
+
};
|
|
2392
|
+
this.asset ? this.transformations = [...this.transformations, i] : this.upsertTransformation(i);
|
|
2393
|
+
}
|
|
2394
|
+
onMetadataChange(t) {
|
|
2395
|
+
const e = t.detail;
|
|
2396
|
+
if (this.preResetTransformations = void 0, this.selectedFormat && (this.selectedFormat = {
|
|
2397
|
+
...this.selectedFormat,
|
|
2398
|
+
keepMetadata: e
|
|
2399
|
+
}), !this.asset) {
|
|
2400
|
+
e ? this.upsertTransformation({
|
|
2401
|
+
key: c.Metadata,
|
|
2402
|
+
value: {
|
|
2403
|
+
keepMetadata: e
|
|
2404
|
+
}
|
|
2405
|
+
}) : this.transformations = this.transformations.filter(
|
|
2406
|
+
(i) => i.key !== c.Metadata
|
|
2407
|
+
);
|
|
2408
|
+
return;
|
|
2409
|
+
}
|
|
2410
|
+
e ? this.transformations = [
|
|
2411
|
+
...this.transformations.filter(
|
|
2412
|
+
(i) => i.key !== c.Metadata
|
|
2413
|
+
),
|
|
2414
|
+
{
|
|
2415
|
+
key: c.Metadata,
|
|
2416
|
+
value: {
|
|
2417
|
+
keepMetadata: e
|
|
2418
|
+
}
|
|
2419
|
+
}
|
|
2420
|
+
] : this.transformations = this.transformations.filter(
|
|
2421
|
+
(i) => i.key !== c.Metadata
|
|
2422
|
+
);
|
|
2423
|
+
}
|
|
2424
|
+
onExtensionChange(t) {
|
|
2425
|
+
const e = t.detail;
|
|
2426
|
+
this.selectedFormat && (this.selectedFormat = {
|
|
2427
|
+
...this.selectedFormat,
|
|
2428
|
+
extension: e
|
|
2429
|
+
});
|
|
2430
|
+
}
|
|
2431
|
+
syncQuality() {
|
|
2432
|
+
const t = this.transformations.findLast(
|
|
2433
|
+
(e) => e.key === c.Quality
|
|
2434
|
+
)?.value?.quality;
|
|
2435
|
+
this.selectedFormat && (this.selectedFormat = {
|
|
2436
|
+
...this.selectedFormat,
|
|
2437
|
+
quality: t ?? 100
|
|
2438
|
+
});
|
|
2439
|
+
}
|
|
2440
|
+
handleUndo() {
|
|
2441
|
+
!this.hasUnfrozenTransformations && this.preResetTransformations !== void 0 ? (this.transformations = this.preResetTransformations, this.preResetTransformations = void 0) : this.transformations = this.transformations.slice(0, -1), this.syncQuality();
|
|
2442
|
+
}
|
|
2443
|
+
handleReset() {
|
|
2444
|
+
this.preResetTransformations = [...this.transformations];
|
|
2445
|
+
const t = !!this.defaultProxy && !!this.proxies?.some((e) => e.id === this.defaultProxy);
|
|
2446
|
+
this.selectedProxy = t ? this.defaultProxy : this.selectedProxy || this.proxies?.[0]?.id || "", this.transformations = [], this.frozenIndex = -1, this.syncQuality();
|
|
2447
|
+
}
|
|
2448
|
+
render() {
|
|
2449
|
+
return x`<div class="asset-link-format" @cx-show=${this.onDetailsShow} @cx-hide=${this.onDetailsHide}>${_(
|
|
2450
|
+
!this.hideHeader,
|
|
2451
|
+
() => x`<cx-space class="asset-link-format__section-header" direction="horizontal" spacing="small" align-items="center" justify-content="space-between"><cx-typography variant="body3">${this.localize.term("transformations")}</cx-typography><cx-space direction="horizontal" spacing="3x-small" align-items="center"><cx-button class="asset-link-format__undo" variant="custom" ?disabled=${!this.hasUnfrozenTransformations && this.preResetTransformations === void 0} @click=${this.handleUndo}>${this.localize.term("undo")}</cx-button>${_(this.canReset, () => x`<cx-button class="asset-link-format__reset" variant="custom" ?disabled=${this.transformations.length === 0} @click=${this.handleReset}>${this.localize.term("reset")}</cx-button>`)}</cx-space></cx-space>`,
|
|
2452
|
+
() => Ut
|
|
2453
|
+
)}
|
|
2454
|
+
${_(
|
|
2455
|
+
!this.noFormat,
|
|
2456
|
+
() => x`<cx-asset-link-format-proxy class="asset-link-format__details" value=${this.selectedProxy || this.proxies?.[0]?.id || ""} ?open=${this.activeSetting === "cx-asset-link-format-proxy"} .items=${this.formats} ?loading=${this.loading && this.lastAction === c.Proxy} @cx-asset-link-format-proxy-change=${this.onProxyChange}></cx-asset-link-format-proxy>`
|
|
2457
|
+
)}
|
|
2458
|
+
${_(
|
|
2459
|
+
!this.noCrop,
|
|
2460
|
+
() => x`<cx-asset-link-format-crop class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-crop"} ?disabled-apply=${this.disabledCropApply} ?can-apply=${!!this.asset} ?loading=${this.loading && this.lastAction === c.Crop} ?keep-aspect-ratio=${this.cropSize.keepAspectRatio} focus-mode=${this.cropSize.focusMode} crop-mode=${this.cropSize.cropMode} width=${this.cropSize.width} height=${this.cropSize.height} max-width=${this.asset ? this.lastResizeSize[o.Pixel].width : 1 / 0} max-height=${this.asset ? this.lastResizeSize[o.Pixel].height : 1 / 0} percentage-width=${this.cropSize.percentageWidth} percentage-height=${this.cropSize.percentageHeight} ratio-width=${this.cropSize.ratioWidth} ratio-height=${this.cropSize.ratioHeight} unit=${this.cropSize.unit} .lastAppliedSetting=${this.lastCropSize} .cropModes=${this.cropModes} .focusModes=${this.focusModes} @cx-asset-link-format-crop-mode-change=${this.onCropModeChange} @cx-asset-link-format-crop-focus-mode-change=${this.onCropFocusModeChange} @cx-asset-link-format-crop-change=${this.onCropChange} @cx-asset-link-format-crop-changed=${this.onCropChanged} @cx-asset-link-format-crop-apply=${this.onCropApply}></cx-asset-link-format-crop>`
|
|
2461
|
+
)}
|
|
2462
|
+
${_(
|
|
2463
|
+
!this.noResize,
|
|
2464
|
+
() => x`<cx-asset-link-format-resize class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-resize"} ?can-apply=${!!this.asset} ?loading=${this.loading && this.lastAction === c.Resize} ?keep-aspect-ratio=${this.resizeSize.keepAspectRatio} width=${this.resizeSize.width} height=${this.resizeSize.height} max-width=${this.asset ? this.imageSize.width : 1 / 0} max-height=${this.asset ? this.imageSize.height : 1 / 0} ratio-width=${this.resizeSize.ratioWidth} ratio-height=${this.resizeSize.ratioHeight} unit=${this.resizeSize.unit} .lastAppliedSetting=${this.lastResizeSize} @cx-asset-link-format-resize-change=${this.onResizeChange} @cx-asset-link-format-resize-apply=${this.onResizeApply}></cx-asset-link-format-resize>`
|
|
2465
|
+
)}
|
|
2466
|
+
${_(
|
|
2467
|
+
!this.noRotate,
|
|
2468
|
+
() => x`<cx-asset-link-format-rotation class="asset-link-format__details" ?loading=${this.loading && this.lastAction === c.Rotate} ?can-apply=${!!this.asset} ?open=${this.activeSetting === "cx-asset-link-format-rotation"} default-value=${this.selectedFormat?.rotation ?? 0} value=${this.rotation} @cx-asset-link-format-rotation-change=${this.onRotationChange} @cx-asset-link-format-rotation-apply=${this.onRotationApply}></cx-asset-link-format-rotation>`
|
|
2469
|
+
)}<cx-asset-link-format-quality class="asset-link-format__details" ?can-apply=${!!this.asset} ?loading=${this.loading && this.lastAction === c.Quality} ?open=${this.activeSetting === "cx-asset-link-format-quality"} value=${this.selectedFormat?.quality ?? 100} @cx-asset-link-format-quality-change=${this.onQualityChange}></cx-asset-link-format-quality>${_(
|
|
2470
|
+
!this.noMetadata,
|
|
2471
|
+
() => x`<cx-asset-link-format-metadata class="asset-link-format__details" ?open=${this.activeSetting === "cx-asset-link-format-metadata"} .value=${this.selectedFormat?.keepMetadata ?? !1} @cx-asset-link-format-metadata-change=${this.onMetadataChange}></cx-asset-link-format-metadata>`
|
|
2472
|
+
)}
|
|
2473
|
+
${_(
|
|
2474
|
+
this.useCustomExtension,
|
|
2475
|
+
() => x`<cx-asset-link-format-extension .items=${this.extensions} value=${this.selectedFormat?.extension ?? ""} @cx-asset-link-format-extension-change=${this.onExtensionChange}></cx-asset-link-format-extension>`
|
|
2476
|
+
)}</div>`;
|
|
2477
|
+
}
|
|
2478
|
+
};
|
|
2479
|
+
p.styles = [U, le];
|
|
2480
|
+
p.dependencies = {
|
|
2481
|
+
"cx-asset-link-format-crop": g,
|
|
2482
|
+
"cx-asset-link-format-extension": V,
|
|
2483
|
+
"cx-asset-link-format-metadata": W,
|
|
2484
|
+
"cx-asset-link-format-proxy": M,
|
|
2485
|
+
"cx-asset-link-format-quality": F,
|
|
2486
|
+
"cx-asset-link-format-resize": z,
|
|
2487
|
+
"cx-asset-link-format-rotation": E,
|
|
2488
|
+
"cx-button": G,
|
|
2489
|
+
"cx-space": D,
|
|
2490
|
+
"cx-typography": T
|
|
2491
|
+
};
|
|
2492
|
+
d([
|
|
2493
|
+
h({ attribute: "base-url", type: String })
|
|
2494
|
+
], p.prototype, "baseUrl", 2);
|
|
2495
|
+
d([
|
|
2496
|
+
h({ attribute: "token", type: String })
|
|
2497
|
+
], p.prototype, "token", 2);
|
|
2498
|
+
d([
|
|
2499
|
+
h({ reflect: !1, type: Object })
|
|
2500
|
+
], p.prototype, "asset", 2);
|
|
2501
|
+
d([
|
|
2502
|
+
h({ attribute: "crop-modes", reflect: !1, type: Array })
|
|
2503
|
+
], p.prototype, "cropModes", 2);
|
|
2504
|
+
d([
|
|
2505
|
+
h({ attribute: "focus-modes", reflect: !1, type: Object })
|
|
2506
|
+
], p.prototype, "focusModes", 2);
|
|
2507
|
+
d([
|
|
2508
|
+
h({ reflect: !1, type: Array })
|
|
2509
|
+
], p.prototype, "extensions", 2);
|
|
2510
|
+
d([
|
|
2511
|
+
h({ reflect: !1, type: Array })
|
|
2512
|
+
], p.prototype, "proxies", 2);
|
|
2513
|
+
d([
|
|
2514
|
+
h({ attribute: "for-cropper", reflect: !0, type: String })
|
|
2515
|
+
], p.prototype, "forCropper", 2);
|
|
2516
|
+
d([
|
|
2517
|
+
h({ attribute: "use-session", reflect: !0, type: String })
|
|
2518
|
+
], p.prototype, "useSession", 2);
|
|
2519
|
+
d([
|
|
2520
|
+
h({ reflect: !1, type: Array })
|
|
2521
|
+
], p.prototype, "transformations", 2);
|
|
2522
|
+
d([
|
|
2523
|
+
h({ attribute: "selected-proxy", reflect: !0, type: String })
|
|
2524
|
+
], p.prototype, "selectedProxy", 2);
|
|
2525
|
+
d([
|
|
2526
|
+
h({ attribute: "default-proxy", reflect: !0, type: String })
|
|
2527
|
+
], p.prototype, "defaultProxy", 2);
|
|
2528
|
+
d([
|
|
2529
|
+
h({ attribute: "use-custom-extension", reflect: !0, type: Boolean })
|
|
2530
|
+
], p.prototype, "useCustomExtension", 2);
|
|
2531
|
+
d([
|
|
2532
|
+
h({ attribute: "no-metadata", reflect: !0, type: Boolean })
|
|
2533
|
+
], p.prototype, "noMetadata", 2);
|
|
2534
|
+
d([
|
|
2535
|
+
h({ attribute: "no-format", reflect: !0, type: Boolean })
|
|
2536
|
+
], p.prototype, "noFormat", 2);
|
|
2537
|
+
d([
|
|
2538
|
+
h({ attribute: "no-crop", reflect: !0, type: Boolean })
|
|
2539
|
+
], p.prototype, "noCrop", 2);
|
|
2540
|
+
d([
|
|
2541
|
+
h({ attribute: "no-resize", reflect: !0, type: Boolean })
|
|
2542
|
+
], p.prototype, "noResize", 2);
|
|
2543
|
+
d([
|
|
2544
|
+
h({ attribute: "no-rotate", reflect: !0, type: Boolean })
|
|
2545
|
+
], p.prototype, "noRotate", 2);
|
|
2546
|
+
d([
|
|
2547
|
+
h({ attribute: "last-image-size", reflect: !1, type: Object })
|
|
2548
|
+
], p.prototype, "lastImageSize", 2);
|
|
2549
|
+
d([
|
|
2550
|
+
h({ attribute: "hide-header", reflect: !1, type: Boolean })
|
|
2551
|
+
], p.prototype, "hideHeader", 2);
|
|
2552
|
+
d([
|
|
2553
|
+
h({ attribute: "can-reset", type: Boolean })
|
|
2554
|
+
], p.prototype, "canReset", 2);
|
|
2555
|
+
d([
|
|
2556
|
+
h({ attribute: !1, reflect: !1, type: Object })
|
|
2557
|
+
], p.prototype, "queryElement", 2);
|
|
2558
|
+
d([
|
|
2559
|
+
v()
|
|
2560
|
+
], p.prototype, "activeSetting", 2);
|
|
2561
|
+
d([
|
|
2562
|
+
v()
|
|
2563
|
+
], p.prototype, "selectedFormat", 2);
|
|
2564
|
+
d([
|
|
2565
|
+
v()
|
|
2566
|
+
], p.prototype, "resizeSize", 2);
|
|
2567
|
+
d([
|
|
2568
|
+
v()
|
|
2569
|
+
], p.prototype, "cropSize", 2);
|
|
2570
|
+
d([
|
|
2571
|
+
v()
|
|
2572
|
+
], p.prototype, "rotation", 2);
|
|
2573
|
+
d([
|
|
2574
|
+
v()
|
|
2575
|
+
], p.prototype, "defaultSize", 2);
|
|
2576
|
+
d([
|
|
2577
|
+
v()
|
|
2578
|
+
], p.prototype, "cropperElement", 2);
|
|
2579
|
+
d([
|
|
2580
|
+
v()
|
|
2581
|
+
], p.prototype, "parameters", 2);
|
|
2582
|
+
d([
|
|
2583
|
+
v()
|
|
2584
|
+
], p.prototype, "loading", 2);
|
|
2585
|
+
d([
|
|
2586
|
+
v()
|
|
2587
|
+
], p.prototype, "lastAction", 2);
|
|
2588
|
+
d([
|
|
2589
|
+
v()
|
|
2590
|
+
], p.prototype, "frozenIndex", 2);
|
|
2591
|
+
d([
|
|
2592
|
+
v()
|
|
2593
|
+
], p.prototype, "preResetTransformations", 2);
|
|
2594
|
+
d([
|
|
2595
|
+
C("transformations")
|
|
2596
|
+
], p.prototype, "handleTransformationsChange", 1);
|
|
2597
|
+
d([
|
|
2598
|
+
C("selectedProxy")
|
|
2599
|
+
], p.prototype, "handleSelectedProxyChange", 1);
|
|
2600
|
+
d([
|
|
2601
|
+
C("loading")
|
|
2602
|
+
], p.prototype, "handleLoadingChange", 1);
|
|
2603
|
+
p = d([
|
|
2604
|
+
q("cx-asset-link-format")
|
|
2605
|
+
], p);
|
|
2606
|
+
export {
|
|
2607
|
+
p as C,
|
|
2608
|
+
dt as D,
|
|
2609
|
+
_t as F,
|
|
2610
|
+
X as O,
|
|
2611
|
+
xi as a,
|
|
2612
|
+
Pt as b,
|
|
2613
|
+
vt as c,
|
|
2614
|
+
gi as d,
|
|
2615
|
+
kt as e,
|
|
2616
|
+
ee as f,
|
|
2617
|
+
Ht as g,
|
|
2618
|
+
Si as h,
|
|
2619
|
+
yi as i,
|
|
2620
|
+
Ct as j,
|
|
2621
|
+
$t as k,
|
|
2622
|
+
Mt as l,
|
|
2623
|
+
Dt as m,
|
|
2624
|
+
st as n,
|
|
2625
|
+
Xt as o,
|
|
2626
|
+
Kt as u
|
|
2627
|
+
};
|