@editora/ui-core 0.1.19 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{ElementBase-1b301e7f.js → ElementBase-EV6mVBUV.js} +1 -1
- package/dist/{ElementBase-909688f3.mjs → ElementBase-YlTLMsGk.mjs} +3 -3
- package/dist/accordion.cjs.js +3 -3
- package/dist/accordion.esm.js +39 -62
- package/dist/alert-dialog.cjs.js +19 -19
- package/dist/alert-dialog.esm.js +69 -87
- package/dist/alert.cjs.js +1 -1
- package/dist/alert.esm.js +4 -7
- package/dist/anchor.cjs.js +2 -2
- package/dist/anchor.esm.js +3 -3
- package/dist/animated-beam.cjs.js +83 -83
- package/dist/animated-beam.esm.js +250 -277
- package/dist/animated-list.cjs.js +4 -4
- package/dist/animated-list.esm.js +47 -61
- package/dist/animated-text.cjs.js +2 -2
- package/dist/animated-text.esm.js +13 -24
- package/dist/app-header.cjs.js +3 -3
- package/dist/app-header.esm.js +11 -13
- package/dist/aspect-ratio.cjs.js +1 -1
- package/dist/aspect-ratio.esm.js +4 -7
- package/dist/avatar.cjs.js +1 -1
- package/dist/avatar.esm.js +7 -13
- package/dist/badge.cjs.js +1 -1
- package/dist/badge.esm.js +4 -7
- package/dist/block-controls.cjs.js +2 -2
- package/dist/block-controls.esm.js +19 -35
- package/dist/box.cjs.js +1 -1
- package/dist/box.esm.js +8 -15
- package/dist/breadcrumb.cjs.js +2 -2
- package/dist/breadcrumb.esm.js +20 -37
- package/dist/button.cjs.js +1 -521
- package/dist/button.esm.js +2 -671
- package/dist/{calendar-2c11b824.mjs → calendar-DLY4acgn.mjs} +293 -342
- package/dist/{calendar-a8735e40.js → calendar-Dkof-FTK.js} +25 -25
- package/dist/calendar.cjs.js +1 -1
- package/dist/calendar.esm.js +8 -9
- package/dist/card.cjs.js +4 -4
- package/dist/card.esm.js +13 -19
- package/dist/chart.cjs.js +64 -64
- package/dist/chart.esm.js +223 -254
- package/dist/checkbox.cjs.js +1 -1
- package/dist/checkbox.esm.js +2 -3
- package/dist/collapsible.cjs.js +1 -1
- package/dist/collapsible.esm.js +5 -9
- package/dist/{collection-a1aac0c6.mjs → collection-C7URGjEI.mjs} +8 -14
- package/dist/collection.cjs.js +1 -1
- package/dist/collection.esm.js +30 -29
- package/dist/color-picker.cjs.js +10 -10
- package/dist/color-picker.esm.js +190 -253
- package/dist/combobox.cjs.js +13 -13
- package/dist/combobox.esm.js +93 -126
- package/dist/command-palette.cjs.js +3 -3
- package/dist/command-palette.esm.js +19 -30
- package/dist/command.cjs.js +4 -4
- package/dist/command.esm.js +41 -53
- package/dist/components/ui-collection.d.ts.map +1 -1
- package/dist/components/ui-multi-select.d.ts.map +1 -1
- package/dist/components/ui-orbiter.d.ts.map +1 -1
- package/dist/components/ui-portal.d.ts.map +1 -1
- package/dist/components/ui-positioner.d.ts.map +1 -1
- package/dist/components/ui-skeleton.d.ts.map +1 -1
- package/dist/components/ui-sortable.d.ts +8 -0
- package/dist/components/ui-sortable.d.ts.map +1 -1
- package/dist/components/ui-split-button.d.ts +1 -0
- package/dist/components/ui-split-button.d.ts.map +1 -1
- package/dist/components/ui-tabs.d.ts.map +1 -1
- package/dist/components/ui-textarea.d.ts.map +1 -1
- package/dist/components/ui-time-picker.d.ts.map +1 -1
- package/dist/container.cjs.js +2 -2
- package/dist/container.esm.js +2 -3
- package/dist/context-menu.cjs.js +8 -8
- package/dist/context-menu.esm.js +157 -219
- package/dist/control-group.cjs.js +1 -1
- package/dist/control-group.esm.js +2 -3
- package/dist/data-table.cjs.js +4 -4
- package/dist/data-table.esm.js +299 -381
- package/dist/date-field.cjs.js +3 -3
- package/dist/date-field.esm.js +68 -80
- package/dist/date-picker.cjs.js +9 -9
- package/dist/date-picker.esm.js +69 -97
- package/dist/date-range-picker.cjs.js +3 -3
- package/dist/date-range-picker.esm.js +32 -56
- package/dist/date-range-time-picker.cjs.js +9 -9
- package/dist/date-range-time-picker.esm.js +111 -140
- package/dist/date-time-picker.cjs.js +7 -7
- package/dist/date-time-picker.esm.js +115 -147
- package/dist/date-time-utils-Dmost5Ee.js +1 -0
- package/dist/date-time-utils-y1N2gvG2.mjs +268 -0
- package/dist/description.cjs.js +1 -1
- package/dist/description.esm.js +3 -5
- package/dist/dialog.cjs.js +12 -12
- package/dist/dialog.esm.js +44 -63
- package/dist/direction-provider.cjs.js +1 -1
- package/dist/direction-provider.esm.js +2 -3
- package/dist/{dismissable-layer-9c7e6b58.mjs → dismissable-layer-BmPIoK80.mjs} +29 -33
- package/dist/dismissable-layer-DNfrKA20.js +1 -0
- package/dist/dismissable-layer.cjs.js +2 -2
- package/dist/dismissable-layer.esm.js +4 -6
- package/dist/dock.cjs.js +5 -5
- package/dist/dock.esm.js +134 -155
- package/dist/drawer.cjs.js +2 -2
- package/dist/drawer.esm.js +18 -35
- package/dist/dropdown.cjs.js +2 -2
- package/dist/dropdown.esm.js +119 -149
- package/dist/dropzone.cjs.js +1 -1
- package/dist/dropzone.esm.js +0 -1
- package/dist/empty-state.cjs.js +1 -1
- package/dist/empty-state.esm.js +1 -1
- package/dist/field-error.cjs.js +1 -1
- package/dist/field-error.esm.js +3 -5
- package/dist/field.cjs.js +5 -5
- package/dist/field.esm.js +27 -34
- package/dist/fieldset.cjs.js +4 -4
- package/dist/fieldset.esm.js +19 -24
- package/dist/file-upload.cjs.js +4 -4
- package/dist/file-upload.esm.js +69 -93
- package/dist/flex.cjs.js +1 -1
- package/dist/flex.esm.js +5 -9
- package/dist/floating-toolbar.cjs.js +4 -4
- package/dist/floating-toolbar.esm.js +60 -85
- package/dist/focus-scope-Bwug2gDv.js +1 -0
- package/dist/{focus-scope-103833ee.mjs → focus-scope-CmEsG5UZ.mjs} +39 -48
- package/dist/focus-scope.cjs.js +2 -2
- package/dist/focus-scope.esm.js +15 -20
- package/dist/form.cjs.js +2 -2
- package/dist/form.esm.js +26 -53
- package/dist/gantt.cjs.js +43 -43
- package/dist/gantt.esm.js +295 -322
- package/dist/grid.cjs.js +1 -1
- package/dist/grid.esm.js +5 -9
- package/dist/hover-card.cjs.js +4 -4
- package/dist/hover-card.esm.js +22 -28
- package/dist/icon-cloud.cjs.js +7 -7
- package/dist/icon-cloud.esm.js +48 -62
- package/dist/icon.cjs.js +1 -1
- package/dist/icon.esm.js +2 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +378 -390
- package/dist/inline-edit.cjs.js +11 -11
- package/dist/inline-edit.esm.js +32 -36
- package/dist/input.cjs.js +17 -17
- package/dist/input.esm.js +50 -63
- package/dist/label.cjs.js +2 -2
- package/dist/label.esm.js +8 -17
- package/dist/layout.cjs.js +2 -2
- package/dist/layout.esm.js +20 -26
- package/dist/listbox-B6QgECax.js +46 -0
- package/dist/listbox-DJamVeFj.mjs +200 -0
- package/dist/listbox.cjs.js +1 -1
- package/dist/listbox.esm.js +2 -4
- package/dist/marquee.cjs.js +5 -5
- package/dist/marquee.esm.js +33 -50
- package/dist/masonry-grid.cjs.js +1 -1
- package/dist/masonry-grid.esm.js +5 -9
- package/dist/menu.cjs.js +3 -3
- package/dist/menu.esm.js +106 -126
- package/dist/menubar.cjs.js +5 -5
- package/dist/menubar.esm.js +118 -164
- package/dist/meter.cjs.js +2 -2
- package/dist/meter.esm.js +4 -4
- package/dist/multi-select.cjs.js +5 -5
- package/dist/multi-select.esm.js +125 -137
- package/dist/navigation-menu.cjs.js +4 -4
- package/dist/navigation-menu.esm.js +44 -55
- package/dist/number-field.cjs.js +2 -2
- package/dist/number-field.esm.js +73 -98
- package/dist/number-ticker.cjs.js +3 -3
- package/dist/number-ticker.esm.js +22 -43
- package/dist/odometer.cjs.js +1 -1
- package/dist/odometer.esm.js +5 -9
- package/dist/orbiter.cjs.js +13 -13
- package/dist/orbiter.esm.js +79 -90
- package/dist/{overlayManager-5bbd4dc3.mjs → overlayManager-BJjU1VA8.mjs} +4 -5
- package/dist/{overlayManager-0eda4e08.js → overlayManager-CSy3fJmJ.js} +1 -1
- package/dist/pagination.cjs.js +2 -2
- package/dist/pagination.esm.js +14 -18
- package/dist/{panel-group-a376cc5e.mjs → panel-group-8sVNnGxg.mjs} +24 -46
- package/dist/panel-group-CaD0_KQf.js +36 -0
- package/dist/panel-group.cjs.js +1 -1
- package/dist/panel-group.esm.js +2 -5
- package/dist/panel.cjs.js +4 -4
- package/dist/panel.esm.js +8 -10
- package/dist/password-field.cjs.js +9 -9
- package/dist/password-field.esm.js +62 -82
- package/dist/pin-input.cjs.js +3 -3
- package/dist/pin-input.esm.js +33 -39
- package/dist/placement-grid.cjs.js +4 -4
- package/dist/placement-grid.esm.js +108 -131
- package/dist/plugin-panel.cjs.js +7 -7
- package/dist/plugin-panel.esm.js +13 -15
- package/dist/popover.cjs.js +2 -2
- package/dist/popover.esm.js +21 -31
- package/dist/portal-DgpQ3Jo1.js +1 -0
- package/dist/{portal-fe73e5cc.mjs → portal-bR42gHvG.mjs} +43 -48
- package/dist/portal.cjs.js +3 -3
- package/dist/portal.esm.js +20 -28
- package/dist/{positioner-e9770c66.mjs → positioner-D0VGxtYU.mjs} +189 -209
- package/dist/positioner-D_fqyx_j.js +1 -0
- package/dist/positioner.cjs.js +2 -2
- package/dist/positioner.esm.js +22 -28
- package/dist/presence.cjs.js +1 -1
- package/dist/presence.esm.js +7 -13
- package/dist/primitives/auto-scroll.d.ts +9 -0
- package/dist/primitives/auto-scroll.d.ts.map +1 -0
- package/dist/primitives/selector.d.ts +4 -0
- package/dist/primitives/selector.d.ts.map +1 -0
- package/dist/progress.cjs.js +1 -1
- package/dist/progress.esm.js +5 -9
- package/dist/quick-actions.cjs.js +6 -6
- package/dist/quick-actions.esm.js +52 -62
- package/dist/radio-group.cjs.js +13 -13
- package/dist/radio-group.esm.js +39 -51
- package/dist/radio.cjs.js +1 -1
- package/dist/radio.esm.js +5 -9
- package/dist/rating.cjs.js +1 -1
- package/dist/rating.esm.js +12 -23
- package/dist/{roving-focus-group-4350c9a7.mjs → roving-focus-group-Dbm1Jko_.mjs} +3 -6
- package/dist/roving-focus-group.cjs.js +1 -1
- package/dist/roving-focus-group.esm.js +3 -5
- package/dist/runtime-CTaOSmBj.js +1 -0
- package/dist/{runtime-161f68a2.mjs → runtime-D1gFh1fS.mjs} +338 -366
- package/dist/runtime.cjs.js +1 -1
- package/dist/runtime.esm.js +6 -6
- package/dist/scroll-area.cjs.js +3 -3
- package/dist/scroll-area.esm.js +38 -46
- package/dist/{scroll-lock-31da444f.mjs → scroll-lock-LfqXXqsu.mjs} +5 -9
- package/dist/section.cjs.js +1 -1
- package/dist/section.esm.js +1 -1
- package/dist/select.cjs.js +7 -7
- package/dist/select.esm.js +67 -97
- package/dist/selection-popup.cjs.js +1 -1
- package/dist/selection-popup.esm.js +8 -15
- package/dist/selector-BvAh35ve.js +1 -0
- package/dist/selector-WI8pD7YO.mjs +18 -0
- package/dist/separator.cjs.js +1 -1
- package/dist/separator.esm.js +1 -1
- package/dist/sidebar.cjs.js +18 -18
- package/dist/sidebar.esm.js +117 -139
- package/dist/skeleton.cjs.js +11 -11
- package/dist/skeleton.esm.js +27 -24
- package/dist/slider.cjs.js +1 -1
- package/dist/slider.esm.js +6 -11
- package/dist/slot.cjs.js +4 -4
- package/dist/slot.esm.js +16 -19
- package/dist/sortable.cjs.js +79 -65
- package/dist/sortable.esm.js +714 -734
- package/dist/spinning-text.cjs.js +12 -12
- package/dist/spinning-text.esm.js +80 -92
- package/dist/split-button.cjs.js +4 -4
- package/dist/split-button.esm.js +77 -62
- package/dist/splitter.cjs.js +1 -1
- package/dist/splitter.esm.js +1 -1
- package/dist/stepper.cjs.js +8 -8
- package/dist/stepper.esm.js +32 -52
- package/dist/switch.cjs.js +7 -7
- package/dist/switch.esm.js +23 -31
- package/dist/table.cjs.js +2 -2
- package/dist/table.esm.js +46 -56
- package/dist/tabs.cjs.js +8 -8
- package/dist/tabs.esm.js +89 -109
- package/dist/tags-input.cjs.js +4 -4
- package/dist/tags-input.esm.js +45 -62
- package/dist/textarea.cjs.js +10 -10
- package/dist/textarea.esm.js +49 -52
- package/dist/time-field.cjs.js +4 -4
- package/dist/time-field.esm.js +70 -84
- package/dist/time-picker.cjs.js +22 -22
- package/dist/time-picker.esm.js +88 -110
- package/dist/timeline.cjs.js +1 -1
- package/dist/timeline.esm.js +3 -5
- package/dist/toast.cjs.js +2 -2
- package/dist/toast.esm.js +33 -47
- package/dist/toggle-group.cjs.js +6 -6
- package/dist/toggle-group.esm.js +85 -105
- package/dist/toggle.cjs.js +1 -1
- package/dist/toggle.esm.js +3 -5
- package/dist/toolbar.cjs.js +1 -1
- package/dist/toolbar.esm.js +13 -24
- package/dist/tooltip.cjs.js +2 -2
- package/dist/tooltip.esm.js +31 -42
- package/dist/transfer-list.cjs.js +31 -31
- package/dist/transfer-list.esm.js +114 -127
- package/dist/{tree-dcd74a4a.mjs → tree-B3kE8ESs.mjs} +55 -62
- package/dist/tree-Dx_kv_ih.js +39 -0
- package/dist/tree-item.cjs.js +2 -2
- package/dist/tree-item.esm.js +2 -3
- package/dist/tree.cjs.js +1 -1
- package/dist/tree.esm.js +2 -5
- package/dist/ui-button-Q0GNNWKC.mjs +665 -0
- package/dist/ui-button-rXQOS9QJ.js +521 -0
- package/dist/{icon-9e9da03b.js → ui-icon-BzVNC_lr.js} +4 -4
- package/dist/{icon-e2a85cc1.mjs → ui-icon-YI6lyuqU.mjs} +58 -65
- package/dist/visually-hidden.cjs.js +1 -1
- package/dist/visually-hidden.esm.js +1 -1
- package/dist/wizard.cjs.js +14 -14
- package/dist/wizard.esm.js +85 -105
- package/package.json +2 -2
- package/dist/date-time-utils-66480de4.js +0 -1
- package/dist/date-time-utils-a2c7af25.mjs +0 -307
- package/dist/dismissable-layer-193e3bed.js +0 -1
- package/dist/focus-scope-2b12b4e7.js +0 -1
- package/dist/listbox-308789a0.mjs +0 -210
- package/dist/listbox-ef2f708e.js +0 -46
- package/dist/panel-group-40254cdd.js +0 -36
- package/dist/portal-c69756c0.js +0 -1
- package/dist/positioner-33529bb8.js +0 -1
- package/dist/runtime-3f13807b.js +0 -1
- package/dist/tree-0a7a8d05.js +0 -39
- /package/dist/{collection-a2969ad2.js → collection-qv8A8rq4.js} +0 -0
- /package/dist/{menu-item-styles-27fdbac4.mjs → menu-item-styles-CZiPwPwl.mjs} +0 -0
- /package/dist/{menu-item-styles-83ad1e22.js → menu-item-styles-CbNUEwP2.js} +0 -0
- /package/dist/{roving-focus-group-5c059bf9.js → roving-focus-group-BdJ_4Njm.js} +0 -0
- /package/dist/{scroll-lock-d7b0df21.js → scroll-lock-BX6e3Ced.js} +0 -0
package/dist/form.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("./ElementBase-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=require("./ElementBase-EV6mVBUV.js");class _{constructor(){this.fields=new Map}registerField(t,e){if(!t)throw new Error("Field must have a name to register with the form");return this.fields.set(t,e),()=>{this.fields.delete(t)}}getValues(){const t={};for(const[e,i]of this.fields)t[e]=i.getValue();return t}setValue(t,e){const i=this.fields.get(t);i&&typeof i.setValue=="function"&&i.setValue(e)}async validateField(t){const e=this.fields.get(t);if(!e)return{valid:!0};if(typeof e.validate=="function"){const i=await e.validate();return e.setError&&e.setError(i.valid?void 0:i.message),i}return{valid:!0}}async validateAll(){const t={};let e=!0;const i=Array.from(this.fields.entries());for(const[r,s]of i){const n=await this.validateField(r);n.valid||(e=!1,t[r]=n.message||"invalid")}return{valid:e,errors:t}}}const v=new Set(["heading","title","description","state-text","loading-text"]),y=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-form-gap: 12px;
|
|
4
4
|
--ui-form-radius: 14px;
|
|
@@ -342,7 +342,7 @@
|
|
|
342
342
|
border-color: CanvasText;
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
|
-
`;function m(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function u(o){if(!o)return!1;const t=o.assignedNodes({flatten:!0});return t.length?t.some(e=>{var i;return e.nodeType===Node.TEXT_NODE?!!((i=e.textContent)!=null&&i.trim()):e.nodeType===Node.ELEMENT_NODE}):!1}function x(o){const t=o.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"}function h(o){if(o==null)return o;if(o instanceof Date)return o.toISOString();if(typeof File<"u"&&o instanceof File)return{__file:!0,name:o.name,size:o.size,type:o.type,lastModified:o.lastModified};if(Array.isArray(o))return o.map(t=>h(t));if(typeof o=="object"){const t=Object.entries(o).sort(([i],[r])=>i.localeCompare(r)),e={};return t.forEach(([i,r])=>{e[i]=h(r)}),e}return o}function c(o){if(Array.isArray(o))return o.map(t=>c(t));if(o&&typeof o=="object"){if(typeof File<"u"&&o instanceof File)return o;if(o instanceof Date)return new Date(o.getTime());const t={};return Object.entries(o).forEach(([e,i])=>{t[e]=c(i)}),t}return o}function A(o){return o==="success"||o==="warning"||o==="error"?o:"default"}class b extends g.ElementBase{constructor(){super(),this._controller=new _,this._submitting=!1,this._autosaveTimer=null,this._readyFrame=null,this._dirtyFrame=null,this._initialSnapshot="",this._cleanValues={},this._baselineReady=!1,this._dirty=!1,this._dirtyAttrSyncing=!1,this._uid=Math.random().toString(36).slice(2,10),this._formEl=null,this._headerEl=null,this._headingEl=null,this._titleEl=null,this._descriptionEl=null,this._titleTextEl=null,this._descriptionTextEl=null,this._actionsEl=null,this._statusEl=null,this._statusTextEl=null,this._footerEl=null,this._titleSlot=null,this._headingSlot=null,this._descriptionSlot=null,this._actionsSlot=null,this._statusSlot=null,this._footerSlot=null,this._descriptionVisible=!1,this._statusVisible=!1,this._onNativeSubmit=this._onNativeSubmit.bind(this),this._onValueEvent=this._onValueEvent.bind(this),this._onBeforeUnload=this._onBeforeUnload.bind(this),this._onSlotChange=this._onSlotChange.bind(this)}static get observedAttributes(){return["novalidate","variant","tone","density","shape","elevation","gap","headless","loading","autosave","autosave-delay","guard-unsaved","dirty","disabled","heading","title","description","state","state-text","loading-text","aria-label","aria-labelledby"]}connectedCallback(){if(super.connectedCallback(),this.hasAttribute("title")&&!this.hasAttribute("heading")){const t=this.getAttribute("title");t!=null&&this.setAttribute("heading",t),this.removeAttribute("title")}this.root.addEventListener("submit",this._onNativeSubmit),this.root.addEventListener("slotchange",this._onSlotChange),this.addEventListener("input",this._onValueEvent),this.addEventListener("change",this._onValueEvent),this.hasAttribute("guard-unsaved")&&typeof window<"u"&&window.addEventListener("beforeunload",this._onBeforeUnload),queueMicrotask(()=>{!this.isConnected||this._baselineReady||this._setBaseline(this.getValues(),!1)}),this.hasAttribute("data-ui-ready")||(typeof requestAnimationFrame=="function"?this._readyFrame=requestAnimationFrame(()=>{this._readyFrame=null,this.setAttribute("data-ui-ready","")}):this._readyFrame=window.setTimeout(()=>{this._readyFrame=null,this.setAttribute("data-ui-ready","")},16))}disconnectedCallback(){this.root.removeEventListener("submit",this._onNativeSubmit),this.root.removeEventListener("slotchange",this._onSlotChange),this.removeEventListener("input",this._onValueEvent),this.removeEventListener("change",this._onValueEvent),this._readyFrame!=null&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this._readyFrame),clearTimeout(this._readyFrame),this._readyFrame=null),this._autosaveTimer&&(clearTimeout(this._autosaveTimer),this._autosaveTimer=null),this._dirtyFrame!=null&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this._dirtyFrame),clearTimeout(this._dirtyFrame),this._dirtyFrame=null),typeof window<"u"&&window.removeEventListener("beforeunload",this._onBeforeUnload),super.disconnectedCallback()}_onNativeSubmit(t){const e=t.target;e!=null&&e.classList.contains("form")&&(t.preventDefault(),t.stopPropagation(),!this.hasAttribute("disabled")&&this.submit())}registerField(t,e){return this._controller.registerField(t,e)}setValue(t,e){this._controller.setValue(t,e),this._setNativeValue(t,e,this._groupNativeControls({includeDisabled:!0})),this._scheduleDirtyRefresh()}setValues(t){if(!t||typeof t!="object")return;const e=this._groupNativeControls({includeDisabled:!0});Object.entries(t).forEach(([i,r])=>{this._controller.setValue(i,r),this._setNativeValue(i,r,e)}),this._scheduleDirtyRefresh()}getValues(){const t={...this._controller.getValues()},e=new Set(Object.keys(t)),i=this._collectNativeValues(e,this._groupNativeControls());return Object.assign(t,i),t}_queryNativeControls(t={}){const{includeDisabled:e=!1}=t;return Array.from(this.querySelectorAll("input[name],textarea[name],select[name]")).filter(r=>!(!x(r)||r.closest("ui-form")!==this||!e&&r.matches(":disabled")))}_groupNativeControls(t={}){const e=new Map;return this._queryNativeControls(t).forEach(i=>{const r=i.getAttribute("name")||"";if(!r)return;const s=e.get(r)||[];s.push(i),e.set(r,s)}),e}_collectNativeValues(t,e){const i={};return e.forEach((r,s)=>{if(t.has(s))return;const n=r[0];if(n){if(n instanceof HTMLInputElement&&n.type==="radio"){const a=r.find(l=>l instanceof HTMLInputElement&&l.checked);i[s]=a?a.value:"";return}if(n instanceof HTMLInputElement&&n.type==="checkbox"){if(r.length===1){i[s]=n.checked;return}i[s]=r.filter(a=>a instanceof HTMLInputElement&&a.checked).map(a=>a.value||"on");return}if(n instanceof HTMLSelectElement&&n.multiple){i[s]=Array.from(n.selectedOptions).map(a=>a.value);return}if(n instanceof HTMLInputElement&&n.type==="file"){i[s]=Array.from(n.files||[]);return}i[s]=n.value}}),i}_setNativeValue(t,e,i){const r=(i||this._groupNativeControls({includeDisabled:!0})).get(t)||[];if(!r.length)return;const s=r[0];if(s){if(s instanceof HTMLInputElement&&s.type==="radio"){const n=String(e??"");r.forEach(a=>{a instanceof HTMLInputElement&&(a.checked=a.value===n)});return}if(s instanceof HTMLInputElement&&s.type==="checkbox"){if(r.length===1){const a=typeof e=="boolean"?e:!!e;s.checked=a;return}const n=Array.isArray(e)?e.map(a=>String(a)):[];r.forEach(a=>{a instanceof HTMLInputElement&&(a.checked=n.includes(a.value||"on"))});return}if(s instanceof HTMLSelectElement&&s.multiple){const n=Array.isArray(e)?e.map(a=>String(a)):[];Array.from(s.options).forEach(a=>{a.selected=n.includes(a.value)});return}s instanceof HTMLInputElement&&s.type==="file"||(s.value=String(e??""))}}async validate(){const t=await this._controller.validateAll(),e=this._validateNativeControls(),i={valid:t.valid&&e.valid,errors:{...e.errors,...t.errors}};return this.dispatchEvent(new CustomEvent("validate",{bubbles:!0,composed:!0,detail:i})),i}_validateNativeControls(){const t={};let e=null,i=!0;return this._groupNativeControls().forEach((s,n)=>{for(const a of s)if(!(!a.willValidate||a.checkValidity())){i=!1,t[n]||(t[n]=a.validationMessage||"invalid"),e||(e=a);break}}),{valid:i,errors:t,firstInvalid:e}}async submit(){if(this._submitting||this.hasAttribute("loading")||this.hasAttribute("disabled"))return!1;this._submitting=!0;const t=this.hasAttribute("loading");t||this.setAttribute("loading","");try{const e=this.getValues();if(!this.hasAttribute("novalidate")){const r=await this._controller.validateAll(),s=this._validateNativeControls(),n={...s.errors,...r.errors},a=r.valid&&s.valid;if(this.dispatchEvent(new CustomEvent("validate",{bubbles:!0,composed:!0,detail:{valid:a,errors:n}})),!a)return this.dispatchEvent(new CustomEvent("invalid",{bubbles:!0,composed:!0,detail:{errors:n,values:e}})),this._focusFirstInvalid(s.firstInvalid,n),!1}return this.dispatchEvent(new CustomEvent("submit",{bubbles:!0,composed:!0,detail:{values:e}})),this.markClean(e),!0}finally{this._submitting=!1,t||this.removeAttribute("loading")}}_focusFirstInvalid(t,e){var n;if(t){t.focus();return}const i=(n=Object.entries(e).find(([,a])=>!!a))==null?void 0:n[0];if(!i)return;const r=i.replace(/"/g,'\\"'),s=this.querySelector(`[name="${r}"]`);!s||typeof s.focus!="function"||s.focus()}async requestSubmit(){return this.submit()}reset(t){if(t&&typeof t=="object"){this.setValues(t),this.markClean(t);return}this.setValues(this._cleanValues),this.markClean(this._cleanValues)}get dirty(){return this._dirty}isDirty(){return this._dirty}markClean(t){if(t&&typeof t=="object"){this._setBaseline(t);return}this._setBaseline(this.getValues())}_setBaseline(t,e=!0){this._cleanValues=c(t||{}),this._initialSnapshot=this._snapshot(this._cleanValues),this._baselineReady=!0,this._setDirty(!1,e)}_snapshot(t){const e=t&&typeof t=="object"?t:this.getValues();try{return JSON.stringify(h(e||{}))}catch{return""}}_setDirty(t,e=!0){this._dirty!==t&&(this._dirty=t,this._dirtyAttrSyncing=!0,t?this.setAttribute("dirty",""):this.hasAttribute("dirty")&&this.removeAttribute("dirty"),this._dirtyAttrSyncing=!1,this._syncStatus(),this._syncFormAttrs(),e&&this.dispatchEvent(new CustomEvent("dirty-change",{bubbles:!0,composed:!0,detail:{dirty:t,values:this.getValues()}})))}_scheduleDirtyRefresh(){if(this._dirtyFrame!=null)return;const t=typeof window<"u"?window.setTimeout.bind(window):setTimeout;this._dirtyFrame=t(()=>{this._dirtyFrame=null,this._refreshDirtyState()},0)}_refreshDirtyState(){if(!this._baselineReady)return;const t=this._snapshot()!==this._initialSnapshot;if(this._setDirty(t),!this.hasAttribute("autosave"))return;if(!t||this.hasAttribute("loading")){this._autosaveTimer&&(clearTimeout(this._autosaveTimer),this._autosaveTimer=null);return}const e=Number(this.getAttribute("autosave-delay")||800),i=Number.isFinite(e)&&e>=0?e:800;this._autosaveTimer&&clearTimeout(this._autosaveTimer),this._autosaveTimer=setTimeout(()=>{this._autosaveTimer=null,this._dirty&&this.dispatchEvent(new CustomEvent("autosave",{bubbles:!0,composed:!0,detail:{values:this.getValues(),dirty:this._dirty}}))},i)}_onValueEvent(t){const e=t.target;if(!e||e===this)return;const i=e.closest("ui-form");i&&i!==this||this._scheduleDirtyRefresh()}_onBeforeUnload(t){!this.hasAttribute("guard-unsaved")||!this._dirty||(t.preventDefault(),t.returnValue="")}_onSlotChange(){this._syncStructure(),this._syncStatus(),this._syncFormAttrs(),this._scheduleDirtyRefresh()}_syncGap(){const t=this.getAttribute("gap");t?this.style.setProperty("--ui-form-gap",t):this.style.removeProperty("--ui-form-gap")}_syncFormAttrs(){const t=this._formEl;if(!t)return;t.setAttribute("aria-busy",this.hasAttribute("loading")?"true":"false");const e=this.hasAttribute("disabled");t.setAttribute("aria-disabled",e?"true":"false"),e?t.setAttribute("inert",""):t.removeAttribute("inert"),this.hasAttribute("novalidate")?t.setAttribute("novalidate",""):t.removeAttribute("novalidate");const i=this.getAttribute("aria-label"),r=this.getAttribute("aria-labelledby");i?t.setAttribute("aria-label",i):t.removeAttribute("aria-label"),r?t.setAttribute("aria-labelledby",r):t.removeAttribute("aria-labelledby");const s=[];this._descriptionVisible&&s.push(`${this._uid}-description`),this._statusVisible&&s.push(`${this._uid}-status`),s.length?t.setAttribute("aria-describedby",s.join(" ")):t.removeAttribute("aria-describedby")}_syncStructure(){const t=(this.getAttribute("heading")||this.getAttribute("title")||"").trim(),e=(this.getAttribute("description")||"").trim(),i=u(this._headingSlot),r=u(this._titleSlot),s=u(this._descriptionSlot),n=u(this._actionsSlot),a=u(this._footerSlot),l=!!t||i||r,d=!!e||s,f=l||d,p=f||n;this._titleTextEl&&(this._titleTextEl.textContent=t,!t||i||r?this._titleTextEl.setAttribute("hidden",""):this._titleTextEl.removeAttribute("hidden")),this._descriptionTextEl&&(this._descriptionTextEl.textContent=e,!e||s?this._descriptionTextEl.setAttribute("hidden",""):this._descriptionTextEl.removeAttribute("hidden")),this._titleEl&&(l?this._titleEl.removeAttribute("hidden"):this._titleEl.setAttribute("hidden","")),this._descriptionEl&&(d?this._descriptionEl.removeAttribute("hidden"):this._descriptionEl.setAttribute("hidden","")),this._headingEl&&(f?this._headingEl.removeAttribute("hidden"):this._headingEl.setAttribute("hidden","")),this._actionsEl&&(n?this._actionsEl.removeAttribute("hidden"):this._actionsEl.setAttribute("hidden","")),this._headerEl&&(p?this._headerEl.removeAttribute("hidden"):this._headerEl.setAttribute("hidden","")),this._footerEl&&(a?this._footerEl.removeAttribute("hidden"):this._footerEl.setAttribute("hidden","")),this._descriptionVisible=d}_deriveStatusTextAndTone(){const t=this.hasAttribute("loading"),e=A(this.getAttribute("state")),i=(this.getAttribute("state-text")||"").trim(),r=(this.getAttribute("loading-text")||"").trim()||"Saving changes...";return t?{text:r,tone:"loading"}:i?{text:i,tone:e}:e==="success"?{text:"Saved",tone:"success"}:e==="warning"?{text:"Needs attention",tone:"warning"}:e==="error"?{text:"Validation errors present",tone:"error"}:this._dirty?{text:"Unsaved changes",tone:"warning"}:{text:"",tone:"default"}}_syncStatus(){if(!this._statusEl||!this._statusTextEl)return;const t=u(this._statusSlot),e=this._deriveStatusTextAndTone();t?this._statusTextEl.setAttribute("hidden",""):(this._statusTextEl.textContent=e.text,e.text?this._statusTextEl.removeAttribute("hidden"):this._statusTextEl.setAttribute("hidden",""));const i=t||!!e.text;i?this._statusEl.removeAttribute("hidden"):this._statusEl.setAttribute("hidden",""),this._statusEl.setAttribute("data-tone",e.tone),this._statusVisible=i}attributeChangedCallback(t,e,i){if(e!==i){if(t==="title"){i!=null&&!this.hasAttribute("heading")&&this.setAttribute("heading",i),this.hasAttribute("title")&&this.removeAttribute("title");return}if(v.has(t)){this._syncStructure(),this._syncStatus(),this._syncFormAttrs();return}if(t==="gap"){this._syncGap();return}if(t==="dirty"){if(!this._dirtyAttrSyncing){const r=this.hasAttribute("dirty");this._dirty=r,this._syncStatus(),this._syncFormAttrs()}return}if(t==="loading"||t==="novalidate"||t==="state"||t==="state-text"||t==="loading-text"||t==="disabled"){this._syncStatus(),this._syncFormAttrs();return}if(t==="guard-unsaved"){if(typeof window>"u")return;this.hasAttribute("guard-unsaved")?window.addEventListener("beforeunload",this._onBeforeUnload):window.removeEventListener("beforeunload",this._onBeforeUnload);return}(t==="aria-label"||t==="aria-labelledby")&&this._syncFormAttrs()}}render(){this._syncGap();const t=this.getAttribute("heading")||this.getAttribute("title")||"",e=this.getAttribute("description")||"";this.setContent(`
|
|
345
|
+
`;function m(o){return o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function u(o){if(!o)return!1;const t=o.assignedNodes({flatten:!0});return t.length?t.some(e=>e.nodeType===Node.TEXT_NODE?!!e.textContent?.trim():e.nodeType===Node.ELEMENT_NODE):!1}function x(o){const t=o.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"}function h(o){if(o==null)return o;if(o instanceof Date)return o.toISOString();if(typeof File<"u"&&o instanceof File)return{__file:!0,name:o.name,size:o.size,type:o.type,lastModified:o.lastModified};if(Array.isArray(o))return o.map(t=>h(t));if(typeof o=="object"){const t=Object.entries(o).sort(([i],[r])=>i.localeCompare(r)),e={};return t.forEach(([i,r])=>{e[i]=h(r)}),e}return o}function c(o){if(Array.isArray(o))return o.map(t=>c(t));if(o&&typeof o=="object"){if(typeof File<"u"&&o instanceof File)return o;if(o instanceof Date)return new Date(o.getTime());const t={};return Object.entries(o).forEach(([e,i])=>{t[e]=c(i)}),t}return o}function A(o){return o==="success"||o==="warning"||o==="error"?o:"default"}class b extends g.ElementBase{constructor(){super(),this._controller=new _,this._submitting=!1,this._autosaveTimer=null,this._readyFrame=null,this._dirtyFrame=null,this._initialSnapshot="",this._cleanValues={},this._baselineReady=!1,this._dirty=!1,this._dirtyAttrSyncing=!1,this._uid=Math.random().toString(36).slice(2,10),this._formEl=null,this._headerEl=null,this._headingEl=null,this._titleEl=null,this._descriptionEl=null,this._titleTextEl=null,this._descriptionTextEl=null,this._actionsEl=null,this._statusEl=null,this._statusTextEl=null,this._footerEl=null,this._titleSlot=null,this._headingSlot=null,this._descriptionSlot=null,this._actionsSlot=null,this._statusSlot=null,this._footerSlot=null,this._descriptionVisible=!1,this._statusVisible=!1,this._onNativeSubmit=this._onNativeSubmit.bind(this),this._onValueEvent=this._onValueEvent.bind(this),this._onBeforeUnload=this._onBeforeUnload.bind(this),this._onSlotChange=this._onSlotChange.bind(this)}static get observedAttributes(){return["novalidate","variant","tone","density","shape","elevation","gap","headless","loading","autosave","autosave-delay","guard-unsaved","dirty","disabled","heading","title","description","state","state-text","loading-text","aria-label","aria-labelledby"]}connectedCallback(){if(super.connectedCallback(),this.hasAttribute("title")&&!this.hasAttribute("heading")){const t=this.getAttribute("title");t!=null&&this.setAttribute("heading",t),this.removeAttribute("title")}this.root.addEventListener("submit",this._onNativeSubmit),this.root.addEventListener("slotchange",this._onSlotChange),this.addEventListener("input",this._onValueEvent),this.addEventListener("change",this._onValueEvent),this.hasAttribute("guard-unsaved")&&typeof window<"u"&&window.addEventListener("beforeunload",this._onBeforeUnload),queueMicrotask(()=>{!this.isConnected||this._baselineReady||this._setBaseline(this.getValues(),!1)}),this.hasAttribute("data-ui-ready")||(typeof requestAnimationFrame=="function"?this._readyFrame=requestAnimationFrame(()=>{this._readyFrame=null,this.setAttribute("data-ui-ready","")}):this._readyFrame=window.setTimeout(()=>{this._readyFrame=null,this.setAttribute("data-ui-ready","")},16))}disconnectedCallback(){this.root.removeEventListener("submit",this._onNativeSubmit),this.root.removeEventListener("slotchange",this._onSlotChange),this.removeEventListener("input",this._onValueEvent),this.removeEventListener("change",this._onValueEvent),this._readyFrame!=null&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this._readyFrame),clearTimeout(this._readyFrame),this._readyFrame=null),this._autosaveTimer&&(clearTimeout(this._autosaveTimer),this._autosaveTimer=null),this._dirtyFrame!=null&&(typeof cancelAnimationFrame=="function"&&cancelAnimationFrame(this._dirtyFrame),clearTimeout(this._dirtyFrame),this._dirtyFrame=null),typeof window<"u"&&window.removeEventListener("beforeunload",this._onBeforeUnload),super.disconnectedCallback()}_onNativeSubmit(t){t.target?.classList.contains("form")&&(t.preventDefault(),t.stopPropagation(),!this.hasAttribute("disabled")&&this.submit())}registerField(t,e){return this._controller.registerField(t,e)}setValue(t,e){this._controller.setValue(t,e),this._setNativeValue(t,e,this._groupNativeControls({includeDisabled:!0})),this._scheduleDirtyRefresh()}setValues(t){if(!t||typeof t!="object")return;const e=this._groupNativeControls({includeDisabled:!0});Object.entries(t).forEach(([i,r])=>{this._controller.setValue(i,r),this._setNativeValue(i,r,e)}),this._scheduleDirtyRefresh()}getValues(){const t={...this._controller.getValues()},e=new Set(Object.keys(t)),i=this._collectNativeValues(e,this._groupNativeControls());return Object.assign(t,i),t}_queryNativeControls(t={}){const{includeDisabled:e=!1}=t;return Array.from(this.querySelectorAll("input[name],textarea[name],select[name]")).filter(r=>!(!x(r)||r.closest("ui-form")!==this||!e&&r.matches(":disabled")))}_groupNativeControls(t={}){const e=new Map;return this._queryNativeControls(t).forEach(i=>{const r=i.getAttribute("name")||"";if(!r)return;const s=e.get(r)||[];s.push(i),e.set(r,s)}),e}_collectNativeValues(t,e){const i={};return e.forEach((r,s)=>{if(t.has(s))return;const n=r[0];if(n){if(n instanceof HTMLInputElement&&n.type==="radio"){const a=r.find(l=>l instanceof HTMLInputElement&&l.checked);i[s]=a?a.value:"";return}if(n instanceof HTMLInputElement&&n.type==="checkbox"){if(r.length===1){i[s]=n.checked;return}i[s]=r.filter(a=>a instanceof HTMLInputElement&&a.checked).map(a=>a.value||"on");return}if(n instanceof HTMLSelectElement&&n.multiple){i[s]=Array.from(n.selectedOptions).map(a=>a.value);return}if(n instanceof HTMLInputElement&&n.type==="file"){i[s]=Array.from(n.files||[]);return}i[s]=n.value}}),i}_setNativeValue(t,e,i){const r=(i||this._groupNativeControls({includeDisabled:!0})).get(t)||[];if(!r.length)return;const s=r[0];if(s){if(s instanceof HTMLInputElement&&s.type==="radio"){const n=String(e??"");r.forEach(a=>{a instanceof HTMLInputElement&&(a.checked=a.value===n)});return}if(s instanceof HTMLInputElement&&s.type==="checkbox"){if(r.length===1){const a=typeof e=="boolean"?e:!!e;s.checked=a;return}const n=Array.isArray(e)?e.map(a=>String(a)):[];r.forEach(a=>{a instanceof HTMLInputElement&&(a.checked=n.includes(a.value||"on"))});return}if(s instanceof HTMLSelectElement&&s.multiple){const n=Array.isArray(e)?e.map(a=>String(a)):[];Array.from(s.options).forEach(a=>{a.selected=n.includes(a.value)});return}s instanceof HTMLInputElement&&s.type==="file"||(s.value=String(e??""))}}async validate(){const t=await this._controller.validateAll(),e=this._validateNativeControls(),i={valid:t.valid&&e.valid,errors:{...e.errors,...t.errors}};return this.dispatchEvent(new CustomEvent("validate",{bubbles:!0,composed:!0,detail:i})),i}_validateNativeControls(){const t={};let e=null,i=!0;return this._groupNativeControls().forEach((s,n)=>{for(const a of s)if(!(!a.willValidate||a.checkValidity())){i=!1,t[n]||(t[n]=a.validationMessage||"invalid"),e||(e=a);break}}),{valid:i,errors:t,firstInvalid:e}}async submit(){if(this._submitting||this.hasAttribute("loading")||this.hasAttribute("disabled"))return!1;this._submitting=!0;const t=this.hasAttribute("loading");t||this.setAttribute("loading","");try{const e=this.getValues();if(!this.hasAttribute("novalidate")){const r=await this._controller.validateAll(),s=this._validateNativeControls(),n={...s.errors,...r.errors},a=r.valid&&s.valid;if(this.dispatchEvent(new CustomEvent("validate",{bubbles:!0,composed:!0,detail:{valid:a,errors:n}})),!a)return this.dispatchEvent(new CustomEvent("invalid",{bubbles:!0,composed:!0,detail:{errors:n,values:e}})),this._focusFirstInvalid(s.firstInvalid,n),!1}return this.dispatchEvent(new CustomEvent("submit",{bubbles:!0,composed:!0,detail:{values:e}})),this.markClean(e),!0}finally{this._submitting=!1,t||this.removeAttribute("loading")}}_focusFirstInvalid(t,e){if(t){t.focus();return}const i=Object.entries(e).find(([,n])=>!!n)?.[0];if(!i)return;const r=i.replace(/"/g,'\\"'),s=this.querySelector(`[name="${r}"]`);!s||typeof s.focus!="function"||s.focus()}async requestSubmit(){return this.submit()}reset(t){if(t&&typeof t=="object"){this.setValues(t),this.markClean(t);return}this.setValues(this._cleanValues),this.markClean(this._cleanValues)}get dirty(){return this._dirty}isDirty(){return this._dirty}markClean(t){if(t&&typeof t=="object"){this._setBaseline(t);return}this._setBaseline(this.getValues())}_setBaseline(t,e=!0){this._cleanValues=c(t||{}),this._initialSnapshot=this._snapshot(this._cleanValues),this._baselineReady=!0,this._setDirty(!1,e)}_snapshot(t){const e=t&&typeof t=="object"?t:this.getValues();try{return JSON.stringify(h(e||{}))}catch{return""}}_setDirty(t,e=!0){this._dirty!==t&&(this._dirty=t,this._dirtyAttrSyncing=!0,t?this.setAttribute("dirty",""):this.hasAttribute("dirty")&&this.removeAttribute("dirty"),this._dirtyAttrSyncing=!1,this._syncStatus(),this._syncFormAttrs(),e&&this.dispatchEvent(new CustomEvent("dirty-change",{bubbles:!0,composed:!0,detail:{dirty:t,values:this.getValues()}})))}_scheduleDirtyRefresh(){if(this._dirtyFrame!=null)return;const t=typeof window<"u"?window.setTimeout.bind(window):setTimeout;this._dirtyFrame=t(()=>{this._dirtyFrame=null,this._refreshDirtyState()},0)}_refreshDirtyState(){if(!this._baselineReady)return;const t=this._snapshot()!==this._initialSnapshot;if(this._setDirty(t),!this.hasAttribute("autosave"))return;if(!t||this.hasAttribute("loading")){this._autosaveTimer&&(clearTimeout(this._autosaveTimer),this._autosaveTimer=null);return}const e=Number(this.getAttribute("autosave-delay")||800),i=Number.isFinite(e)&&e>=0?e:800;this._autosaveTimer&&clearTimeout(this._autosaveTimer),this._autosaveTimer=setTimeout(()=>{this._autosaveTimer=null,this._dirty&&this.dispatchEvent(new CustomEvent("autosave",{bubbles:!0,composed:!0,detail:{values:this.getValues(),dirty:this._dirty}}))},i)}_onValueEvent(t){const e=t.target;if(!e||e===this)return;const i=e.closest("ui-form");i&&i!==this||this._scheduleDirtyRefresh()}_onBeforeUnload(t){!this.hasAttribute("guard-unsaved")||!this._dirty||(t.preventDefault(),t.returnValue="")}_onSlotChange(){this._syncStructure(),this._syncStatus(),this._syncFormAttrs(),this._scheduleDirtyRefresh()}_syncGap(){const t=this.getAttribute("gap");t?this.style.setProperty("--ui-form-gap",t):this.style.removeProperty("--ui-form-gap")}_syncFormAttrs(){const t=this._formEl;if(!t)return;t.setAttribute("aria-busy",this.hasAttribute("loading")?"true":"false");const e=this.hasAttribute("disabled");t.setAttribute("aria-disabled",e?"true":"false"),e?t.setAttribute("inert",""):t.removeAttribute("inert"),this.hasAttribute("novalidate")?t.setAttribute("novalidate",""):t.removeAttribute("novalidate");const i=this.getAttribute("aria-label"),r=this.getAttribute("aria-labelledby");i?t.setAttribute("aria-label",i):t.removeAttribute("aria-label"),r?t.setAttribute("aria-labelledby",r):t.removeAttribute("aria-labelledby");const s=[];this._descriptionVisible&&s.push(`${this._uid}-description`),this._statusVisible&&s.push(`${this._uid}-status`),s.length?t.setAttribute("aria-describedby",s.join(" ")):t.removeAttribute("aria-describedby")}_syncStructure(){const t=(this.getAttribute("heading")||this.getAttribute("title")||"").trim(),e=(this.getAttribute("description")||"").trim(),i=u(this._headingSlot),r=u(this._titleSlot),s=u(this._descriptionSlot),n=u(this._actionsSlot),a=u(this._footerSlot),l=!!t||i||r,d=!!e||s,f=l||d,p=f||n;this._titleTextEl&&(this._titleTextEl.textContent=t,!t||i||r?this._titleTextEl.setAttribute("hidden",""):this._titleTextEl.removeAttribute("hidden")),this._descriptionTextEl&&(this._descriptionTextEl.textContent=e,!e||s?this._descriptionTextEl.setAttribute("hidden",""):this._descriptionTextEl.removeAttribute("hidden")),this._titleEl&&(l?this._titleEl.removeAttribute("hidden"):this._titleEl.setAttribute("hidden","")),this._descriptionEl&&(d?this._descriptionEl.removeAttribute("hidden"):this._descriptionEl.setAttribute("hidden","")),this._headingEl&&(f?this._headingEl.removeAttribute("hidden"):this._headingEl.setAttribute("hidden","")),this._actionsEl&&(n?this._actionsEl.removeAttribute("hidden"):this._actionsEl.setAttribute("hidden","")),this._headerEl&&(p?this._headerEl.removeAttribute("hidden"):this._headerEl.setAttribute("hidden","")),this._footerEl&&(a?this._footerEl.removeAttribute("hidden"):this._footerEl.setAttribute("hidden","")),this._descriptionVisible=d}_deriveStatusTextAndTone(){const t=this.hasAttribute("loading"),e=A(this.getAttribute("state")),i=(this.getAttribute("state-text")||"").trim(),r=(this.getAttribute("loading-text")||"").trim()||"Saving changes...";return t?{text:r,tone:"loading"}:i?{text:i,tone:e}:e==="success"?{text:"Saved",tone:"success"}:e==="warning"?{text:"Needs attention",tone:"warning"}:e==="error"?{text:"Validation errors present",tone:"error"}:this._dirty?{text:"Unsaved changes",tone:"warning"}:{text:"",tone:"default"}}_syncStatus(){if(!this._statusEl||!this._statusTextEl)return;const t=u(this._statusSlot),e=this._deriveStatusTextAndTone();t?this._statusTextEl.setAttribute("hidden",""):(this._statusTextEl.textContent=e.text,e.text?this._statusTextEl.removeAttribute("hidden"):this._statusTextEl.setAttribute("hidden",""));const i=t||!!e.text;i?this._statusEl.removeAttribute("hidden"):this._statusEl.setAttribute("hidden",""),this._statusEl.setAttribute("data-tone",e.tone),this._statusVisible=i}attributeChangedCallback(t,e,i){if(e!==i){if(t==="title"){i!=null&&!this.hasAttribute("heading")&&this.setAttribute("heading",i),this.hasAttribute("title")&&this.removeAttribute("title");return}if(v.has(t)){this._syncStructure(),this._syncStatus(),this._syncFormAttrs();return}if(t==="gap"){this._syncGap();return}if(t==="dirty"){if(!this._dirtyAttrSyncing){const r=this.hasAttribute("dirty");this._dirty=r,this._syncStatus(),this._syncFormAttrs()}return}if(t==="loading"||t==="novalidate"||t==="state"||t==="state-text"||t==="loading-text"||t==="disabled"){this._syncStatus(),this._syncFormAttrs();return}if(t==="guard-unsaved"){if(typeof window>"u")return;this.hasAttribute("guard-unsaved")?window.addEventListener("beforeunload",this._onBeforeUnload):window.removeEventListener("beforeunload",this._onBeforeUnload);return}(t==="aria-label"||t==="aria-labelledby")&&this._syncFormAttrs()}}render(){this._syncGap();const t=this.getAttribute("heading")||this.getAttribute("title")||"",e=this.getAttribute("description")||"";this.setContent(`
|
|
346
346
|
<style>${y}</style>
|
|
347
347
|
<form
|
|
348
348
|
class="form"
|
package/dist/form.esm.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { E as p } from "./ElementBase-
|
|
1
|
+
import { E as p } from "./ElementBase-YlTLMsGk.mjs";
|
|
2
2
|
class g {
|
|
3
3
|
constructor() {
|
|
4
4
|
this.fields = /* @__PURE__ */ new Map();
|
|
5
5
|
}
|
|
6
6
|
registerField(t, e) {
|
|
7
|
-
if (!t)
|
|
8
|
-
throw new Error("Field must have a name to register with the form");
|
|
7
|
+
if (!t) throw new Error("Field must have a name to register with the form");
|
|
9
8
|
return this.fields.set(t, e), () => {
|
|
10
9
|
this.fields.delete(t);
|
|
11
10
|
};
|
|
@@ -22,8 +21,7 @@ class g {
|
|
|
22
21
|
}
|
|
23
22
|
async validateField(t) {
|
|
24
23
|
const e = this.fields.get(t);
|
|
25
|
-
if (!e)
|
|
26
|
-
return { valid: !0 };
|
|
24
|
+
if (!e) return { valid: !0 };
|
|
27
25
|
if (typeof e.validate == "function") {
|
|
28
26
|
const i = await e.validate();
|
|
29
27
|
return e.setError && e.setError(i.valid ? void 0 : i.message), i;
|
|
@@ -390,23 +388,17 @@ function m(o) {
|
|
|
390
388
|
return o.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
391
389
|
}
|
|
392
390
|
function u(o) {
|
|
393
|
-
if (!o)
|
|
394
|
-
return !1;
|
|
391
|
+
if (!o) return !1;
|
|
395
392
|
const t = o.assignedNodes({ flatten: !0 });
|
|
396
|
-
return t.length ? t.some((e) =>
|
|
397
|
-
var i;
|
|
398
|
-
return e.nodeType === Node.TEXT_NODE ? !!((i = e.textContent) != null && i.trim()) : e.nodeType === Node.ELEMENT_NODE;
|
|
399
|
-
}) : !1;
|
|
393
|
+
return t.length ? t.some((e) => e.nodeType === Node.TEXT_NODE ? !!e.textContent?.trim() : e.nodeType === Node.ELEMENT_NODE) : !1;
|
|
400
394
|
}
|
|
401
395
|
function y(o) {
|
|
402
396
|
const t = o.tagName.toLowerCase();
|
|
403
397
|
return t === "input" || t === "textarea" || t === "select";
|
|
404
398
|
}
|
|
405
399
|
function h(o) {
|
|
406
|
-
if (o == null)
|
|
407
|
-
|
|
408
|
-
if (o instanceof Date)
|
|
409
|
-
return o.toISOString();
|
|
400
|
+
if (o == null) return o;
|
|
401
|
+
if (o instanceof Date) return o.toISOString();
|
|
410
402
|
if (typeof File < "u" && o instanceof File)
|
|
411
403
|
return {
|
|
412
404
|
__file: !0,
|
|
@@ -415,8 +407,7 @@ function h(o) {
|
|
|
415
407
|
type: o.type,
|
|
416
408
|
lastModified: o.lastModified
|
|
417
409
|
};
|
|
418
|
-
if (Array.isArray(o))
|
|
419
|
-
return o.map((t) => h(t));
|
|
410
|
+
if (Array.isArray(o)) return o.map((t) => h(t));
|
|
420
411
|
if (typeof o == "object") {
|
|
421
412
|
const t = Object.entries(o).sort(([i], [r]) => i.localeCompare(r)), e = {};
|
|
422
413
|
return t.forEach(([i, r]) => {
|
|
@@ -426,13 +417,10 @@ function h(o) {
|
|
|
426
417
|
return o;
|
|
427
418
|
}
|
|
428
419
|
function c(o) {
|
|
429
|
-
if (Array.isArray(o))
|
|
430
|
-
return o.map((t) => c(t));
|
|
420
|
+
if (Array.isArray(o)) return o.map((t) => c(t));
|
|
431
421
|
if (o && typeof o == "object") {
|
|
432
|
-
if (typeof File < "u" && o instanceof File)
|
|
433
|
-
|
|
434
|
-
if (o instanceof Date)
|
|
435
|
-
return new Date(o.getTime());
|
|
422
|
+
if (typeof File < "u" && o instanceof File) return o;
|
|
423
|
+
if (o instanceof Date) return new Date(o.getTime());
|
|
436
424
|
const t = {};
|
|
437
425
|
return Object.entries(o).forEach(([e, i]) => {
|
|
438
426
|
t[e] = c(i);
|
|
@@ -490,8 +478,7 @@ class A extends p {
|
|
|
490
478
|
this.root.removeEventListener("submit", this._onNativeSubmit), this.root.removeEventListener("slotchange", this._onSlotChange), this.removeEventListener("input", this._onValueEvent), this.removeEventListener("change", this._onValueEvent), this._readyFrame != null && (typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this._readyFrame), clearTimeout(this._readyFrame), this._readyFrame = null), this._autosaveTimer && (clearTimeout(this._autosaveTimer), this._autosaveTimer = null), this._dirtyFrame != null && (typeof cancelAnimationFrame == "function" && cancelAnimationFrame(this._dirtyFrame), clearTimeout(this._dirtyFrame), this._dirtyFrame = null), typeof window < "u" && window.removeEventListener("beforeunload", this._onBeforeUnload), super.disconnectedCallback();
|
|
491
479
|
}
|
|
492
480
|
_onNativeSubmit(t) {
|
|
493
|
-
|
|
494
|
-
e != null && e.classList.contains("form") && (t.preventDefault(), t.stopPropagation(), !this.hasAttribute("disabled") && this.submit());
|
|
481
|
+
t.target?.classList.contains("form") && (t.preventDefault(), t.stopPropagation(), !this.hasAttribute("disabled") && this.submit());
|
|
495
482
|
}
|
|
496
483
|
registerField(t, e) {
|
|
497
484
|
return this._controller.registerField(t, e);
|
|
@@ -500,8 +487,7 @@ class A extends p {
|
|
|
500
487
|
this._controller.setValue(t, e), this._setNativeValue(t, e, this._groupNativeControls({ includeDisabled: !0 })), this._scheduleDirtyRefresh();
|
|
501
488
|
}
|
|
502
489
|
setValues(t) {
|
|
503
|
-
if (!t || typeof t != "object")
|
|
504
|
-
return;
|
|
490
|
+
if (!t || typeof t != "object") return;
|
|
505
491
|
const e = this._groupNativeControls({ includeDisabled: !0 });
|
|
506
492
|
Object.entries(t).forEach(([i, r]) => {
|
|
507
493
|
this._controller.setValue(i, r), this._setNativeValue(i, r, e);
|
|
@@ -519,8 +505,7 @@ class A extends p {
|
|
|
519
505
|
const e = /* @__PURE__ */ new Map();
|
|
520
506
|
return this._queryNativeControls(t).forEach((i) => {
|
|
521
507
|
const r = i.getAttribute("name") || "";
|
|
522
|
-
if (!r)
|
|
523
|
-
return;
|
|
508
|
+
if (!r) return;
|
|
524
509
|
const s = e.get(r) || [];
|
|
525
510
|
s.push(i), e.set(r, s);
|
|
526
511
|
}), e;
|
|
@@ -528,8 +513,7 @@ class A extends p {
|
|
|
528
513
|
_collectNativeValues(t, e) {
|
|
529
514
|
const i = {};
|
|
530
515
|
return e.forEach((r, s) => {
|
|
531
|
-
if (t.has(s))
|
|
532
|
-
return;
|
|
516
|
+
if (t.has(s)) return;
|
|
533
517
|
const n = r[0];
|
|
534
518
|
if (n) {
|
|
535
519
|
if (n instanceof HTMLInputElement && n.type === "radio") {
|
|
@@ -559,8 +543,7 @@ class A extends p {
|
|
|
559
543
|
}
|
|
560
544
|
_setNativeValue(t, e, i) {
|
|
561
545
|
const r = (i || this._groupNativeControls({ includeDisabled: !0 })).get(t) || [];
|
|
562
|
-
if (!r.length)
|
|
563
|
-
return;
|
|
546
|
+
if (!r.length) return;
|
|
564
547
|
const s = r[0];
|
|
565
548
|
if (s) {
|
|
566
549
|
if (s instanceof HTMLInputElement && s.type === "radio") {
|
|
@@ -617,8 +600,7 @@ class A extends p {
|
|
|
617
600
|
}), { valid: i, errors: t, firstInvalid: e };
|
|
618
601
|
}
|
|
619
602
|
async submit() {
|
|
620
|
-
if (this._submitting || this.hasAttribute("loading") || this.hasAttribute("disabled"))
|
|
621
|
-
return !1;
|
|
603
|
+
if (this._submitting || this.hasAttribute("loading") || this.hasAttribute("disabled")) return !1;
|
|
622
604
|
this._submitting = !0;
|
|
623
605
|
const t = this.hasAttribute("loading");
|
|
624
606
|
t || this.setAttribute("loading", "");
|
|
@@ -653,14 +635,12 @@ class A extends p {
|
|
|
653
635
|
}
|
|
654
636
|
}
|
|
655
637
|
_focusFirstInvalid(t, e) {
|
|
656
|
-
var n;
|
|
657
638
|
if (t) {
|
|
658
639
|
t.focus();
|
|
659
640
|
return;
|
|
660
641
|
}
|
|
661
|
-
const i =
|
|
662
|
-
if (!i)
|
|
663
|
-
return;
|
|
642
|
+
const i = Object.entries(e).find(([, n]) => !!n)?.[0];
|
|
643
|
+
if (!i) return;
|
|
664
644
|
const r = i.replace(/"/g, '\\"'), s = this.querySelector(`[name="${r}"]`);
|
|
665
645
|
!s || typeof s.focus != "function" || s.focus();
|
|
666
646
|
}
|
|
@@ -708,19 +688,16 @@ class A extends p {
|
|
|
708
688
|
));
|
|
709
689
|
}
|
|
710
690
|
_scheduleDirtyRefresh() {
|
|
711
|
-
if (this._dirtyFrame != null)
|
|
712
|
-
return;
|
|
691
|
+
if (this._dirtyFrame != null) return;
|
|
713
692
|
const t = typeof window < "u" ? window.setTimeout.bind(window) : setTimeout;
|
|
714
693
|
this._dirtyFrame = t(() => {
|
|
715
694
|
this._dirtyFrame = null, this._refreshDirtyState();
|
|
716
695
|
}, 0);
|
|
717
696
|
}
|
|
718
697
|
_refreshDirtyState() {
|
|
719
|
-
if (!this._baselineReady)
|
|
720
|
-
return;
|
|
698
|
+
if (!this._baselineReady) return;
|
|
721
699
|
const t = this._snapshot() !== this._initialSnapshot;
|
|
722
|
-
if (this._setDirty(t), !this.hasAttribute("autosave"))
|
|
723
|
-
return;
|
|
700
|
+
if (this._setDirty(t), !this.hasAttribute("autosave")) return;
|
|
724
701
|
if (!t || this.hasAttribute("loading")) {
|
|
725
702
|
this._autosaveTimer && (clearTimeout(this._autosaveTimer), this._autosaveTimer = null);
|
|
726
703
|
return;
|
|
@@ -738,8 +715,7 @@ class A extends p {
|
|
|
738
715
|
}
|
|
739
716
|
_onValueEvent(t) {
|
|
740
717
|
const e = t.target;
|
|
741
|
-
if (!e || e === this)
|
|
742
|
-
return;
|
|
718
|
+
if (!e || e === this) return;
|
|
743
719
|
const i = e.closest("ui-form");
|
|
744
720
|
i && i !== this || this._scheduleDirtyRefresh();
|
|
745
721
|
}
|
|
@@ -755,8 +731,7 @@ class A extends p {
|
|
|
755
731
|
}
|
|
756
732
|
_syncFormAttrs() {
|
|
757
733
|
const t = this._formEl;
|
|
758
|
-
if (!t)
|
|
759
|
-
return;
|
|
734
|
+
if (!t) return;
|
|
760
735
|
t.setAttribute("aria-busy", this.hasAttribute("loading") ? "true" : "false");
|
|
761
736
|
const e = this.hasAttribute("disabled");
|
|
762
737
|
t.setAttribute("aria-disabled", e ? "true" : "false"), e ? t.setAttribute("inert", "") : t.removeAttribute("inert"), this.hasAttribute("novalidate") ? t.setAttribute("novalidate", "") : t.removeAttribute("novalidate");
|
|
@@ -774,8 +749,7 @@ class A extends p {
|
|
|
774
749
|
return t ? { text: r, tone: "loading" } : i ? { text: i, tone: e } : e === "success" ? { text: "Saved", tone: "success" } : e === "warning" ? { text: "Needs attention", tone: "warning" } : e === "error" ? { text: "Validation errors present", tone: "error" } : this._dirty ? { text: "Unsaved changes", tone: "warning" } : { text: "", tone: "default" };
|
|
775
750
|
}
|
|
776
751
|
_syncStatus() {
|
|
777
|
-
if (!this._statusEl || !this._statusTextEl)
|
|
778
|
-
return;
|
|
752
|
+
if (!this._statusEl || !this._statusTextEl) return;
|
|
779
753
|
const t = u(this._statusSlot), e = this._deriveStatusTextAndTone();
|
|
780
754
|
t ? this._statusTextEl.setAttribute("hidden", "") : (this._statusTextEl.textContent = e.text, e.text ? this._statusTextEl.removeAttribute("hidden") : this._statusTextEl.setAttribute("hidden", ""));
|
|
781
755
|
const i = t || !!e.text;
|
|
@@ -807,8 +781,7 @@ class A extends p {
|
|
|
807
781
|
return;
|
|
808
782
|
}
|
|
809
783
|
if (t === "guard-unsaved") {
|
|
810
|
-
if (typeof window > "u")
|
|
811
|
-
return;
|
|
784
|
+
if (typeof window > "u") return;
|
|
812
785
|
this.hasAttribute("guard-unsaved") ? window.addEventListener("beforeunload", this._onBeforeUnload) : window.removeEventListener("beforeunload", this._onBeforeUnload);
|
|
813
786
|
return;
|
|
814
787
|
}
|
package/dist/gantt.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const At=require("./ElementBase-EV6mVBUV.js"),I=1440*60*1e3,y=42,W=62,J=376,N=28,Lt=15,vt=Lt*Math.SQRT2/2,gt={day:36,week:13,month:4.4,quarter:2.2,year:1.15},ht=`
|
|
2
2
|
:host {
|
|
3
3
|
--ui-gantt-bg: color-mix(in srgb, var(--ui-color-surface, #ffffff) 96%, transparent);
|
|
4
4
|
--ui-gantt-panel: var(--ui-color-surface, #ffffff);
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
|
|
201
201
|
.grid-row,
|
|
202
202
|
.timeline-row {
|
|
203
|
-
block-size: ${
|
|
203
|
+
block-size: ${y}px;
|
|
204
204
|
border-bottom: 1px solid color-mix(in srgb, var(--ui-gantt-border) 56%, transparent);
|
|
205
205
|
}
|
|
206
206
|
|
|
@@ -656,84 +656,84 @@
|
|
|
656
656
|
box-shadow: none;
|
|
657
657
|
}
|
|
658
658
|
}
|
|
659
|
-
`,
|
|
660
|
-
<style>${
|
|
659
|
+
`,mt={default:"var(--ui-color-primary, #2563eb)",info:"var(--ui-color-info, #0891b2)",success:"var(--ui-color-success, #16a34a)",warning:"var(--ui-color-warning, #d97706)",danger:"var(--ui-color-danger, #dc2626)"};function b(a){return String(a??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function f(a){if(a instanceof Date){const n=a.getTime();return Number.isFinite(n)?D(n):null}const t=String(a||"").trim(),i=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);if(i){const n=Number(i[1]),s=Number(i[2]),l=Number(i[3]),p=new Date(n,s-1,l).getTime();return Number.isFinite(p)?D(p):null}const e=Date.parse(t);return Number.isFinite(e)?D(e):null}function D(a){const t=new Date(a);return t.setHours(0,0,0,0),t.getTime()}function x(a,t){return D(a+t*I)}function S(a){const t=new Date(a),i=t.getFullYear(),e=String(t.getMonth()+1).padStart(2,"0"),n=String(t.getDate()).padStart(2,"0");return`${i}-${e}-${n}`}function O(a){return new Intl.DateTimeFormat(void 0,{month:"short",day:"numeric"}).format(new Date(a))}function bt(a){return a==="day"||a==="month"||a==="quarter"||a==="year"?a:"week"}function j(a){return a==="start"||a==="end"||a==="label"||a==="progress"?a:"none"}function Ft(a){return a==="soft"||a==="striped"||a==="outline"||a==="glass"?a:"solid"}function Dt(a,t){if(!a)return[];try{const i=JSON.parse(a);return Array.isArray(i)?i.map((e,n)=>{if(!e||typeof e!="object")return null;const s=e,l=String(s.label||s.text||"").trim(),o=f(s.start),p=Number(s.duration);let u=f(s.end);if(u==null&&o!=null&&Number.isFinite(p)&&(u=x(o,Math.max(0,p))),!l||o==null)return null;const d=s.type==="summary"||s.type==="milestone"?s.type:"task",g=d==="milestone"?o:Math.max(u??x(o,1),x(o,1)),c=String(s.id||`task-${n+1}`),m=t.get(c)||{};return{id:c,label:l,start:m.start||S(o),end:m.end||S(g),progress:Number.isFinite(Number(s.progress))?Math.max(0,Math.min(100,Number(s.progress))):void 0,tone:typeof s.tone=="string"?s.tone:void 0,type:d,parent:s.parent!=null?String(s.parent):void 0,open:s.open!==!1,assignee:s.assignee!=null?String(s.assignee):s.owner!=null?String(s.owner):void 0,readonly:s.readonly===!0,baselineStart:s.baselineStart!=null?String(s.baselineStart):void 0,baselineEnd:s.baselineEnd!=null?String(s.baselineEnd):void 0,critical:s.critical===!0,segments:Array.isArray(s.segments)?s.segments:void 0}}).filter(Boolean):[]}catch{return[]}}function Rt(a){if(!a)return[];try{const t=JSON.parse(a);return Array.isArray(t)?t.map((i,e)=>{if(!i||typeof i!="object")return null;const n=i,s=String(n.source||"").trim(),l=String(n.target||"").trim();if(!s||!l)return null;const o=n.type==="s2s"||n.type==="e2e"||n.type==="s2e"?n.type:"e2s";return{id:String(n.id||`link-${e+1}`),source:s,target:l,type:o}}).filter(Boolean):[]}catch{return[]}}function qt(a,t){return t==="none"?a:[...a].sort((i,e)=>{if(t==="label")return i.label.localeCompare(e.label);if(t==="progress")return Number(e.progress??0)-Number(i.progress??0);const n=f(t==="start"?i.start:i.end)??0,s=f(t==="start"?e.start:e.end)??0;return n-s})}function Nt(a,t,i,e){const n=new Map,s=new Map(a.map(d=>[d.id,d]));a.forEach(d=>{const g=d.parent&&s.has(d.parent)?d.parent:"__root__",c=n.get(g)||[];c.push(d),n.set(g,c)});const l=i.trim().toLowerCase(),o=d=>!l||d.label.toLowerCase().includes(l)||(d.assignee||"").toLowerCase().includes(l)?!0:(n.get(d.id)||[]).some(o),p=[],u=(d,g)=>{qt(n.get(d)||[],e).forEach(c=>{if(!o(c))return;const m=f(c.start),h=f(c.end);if(m==null||h==null)return;const w=(n.get(c.id)||[]).length>0;p.push({...c,depth:g,hasChildren:w,startMs:m,endMs:h}),w&&!t.has(c.id)&&u(c.id,g+1)})};return u("__root__",0),p}function Ht(a,t,i,e,n=0,s=Number.POSITIVE_INFINITY){const l=Math.max(1,Math.ceil((t-a)/I)),o=e==="day"?1:e==="week"?7:e==="month"?30:e==="quarter"?91:365,p=Math.max(0,Math.floor(Math.max(0,n-480)/i/o)*o),u=Math.min(l,Math.ceil((n+s+960)/i/o)*o),d=[];for(let g=p;g<=u;g+=o){const c=g*i,m=x(a,g),h=e==="day"?O(m):new Intl.DateTimeFormat(void 0,{month:"short",year:e==="week"||e==="month"?void 0:"numeric"}).format(new Date(m));d.push(`<span class="tick" style="left:${c.toFixed(2)}px">${b(h)}</span>`)}return d.join("")}function H(a){return a.type==="summary"||a.hasChildren?"summary":a.type==="milestone"||a.startMs===a.endMs?"milestone":"task"}function ft(a){const t=H(a);return t==="summary"?17+9/2:t==="milestone"?7+N/2:12+18/2}function _t(a,t){return H(a)==="milestone"?t(a.startMs)-vt:t(a.startMs)}function Vt(a,t){return H(a)==="milestone"?t(a.startMs)+vt:t(a.endMs)}function xt(a,t,i){return t==="start"?_t(a,i):Vt(a,i)}function Wt(a="e2s"){return a==="s2s"?{source:"start",target:"start"}:a==="e2e"?{source:"end",target:"end"}:a==="s2e"?{source:"start",target:"end"}:{source:"end",target:"start"}}function jt(a,t,i,e,n,s){const l=Wt(n),o=l.source==="start"?-1:1,p=l.target==="start"?1:-1,u=xt(a,l.source,s),d=xt(i,l.target,s),g=t*y+ft(a),c=e*y+ft(i),m=22,h=u+o*m,w=d-p*m,M=26;let k=(h+w)/2;if(o===p){const T=o===1?Math.max(h,w,u,d)+M:Math.min(h,w,u,d)-M;k=(o===1?w>h+M:w<h-M)?k:T}else(o===1?w<h:w>h)&&(k=o===1?Math.max(h,u,d)+M:Math.min(h,u,d)-M);const A=Math.abs(c-g)<1?l.target==="start"?c-16:c+16:c>g?c-y/2+3:c+y/2-3;return[[u,g],[h,g],[k,g],[k,A],[w,A],[w,c],[d,c]].map(([T,R],P)=>`${P===0?"M":"L"} ${T.toFixed(1)} ${R.toFixed(1)}`).join(" ")}class wt extends At.ElementBase{constructor(){super(...arguments),this.collapsed=new Set,this.overrides=new Map,this.drag=null,this.selectedId=null,this.internalFilter="",this.viewportTop=0,this.viewportLeft=0,this.viewportWidth=1800,this.viewportHeight=620,this.renderedFirstRow=0,this.renderedLastRow=0,this.scrollFrame=null,this.overridesVersion=0,this.taskCacheRaw=null,this.taskCacheVersion=-1,this.taskCache=[],this.linkCacheRaw=null,this.linkCache=[],this.visibleCacheKey="",this.visibleCache=[]}static get observedAttributes(){return["tasks","links","zoom","filter","sort","bar-variant","variant","readonly","show-toolbar","show-today","headless"]}render(){const t=this.getTasks(),i=this.getLinks(),e=bt(this.getAttribute("zoom")),n=j(this.getAttribute("sort")),s=Ft(this.getAttribute("bar-variant")),l=this.getAttribute("filter")??this.internalFilter,o=this.getVisibleTasks(t,l,n),p=this.hasAttribute("readonly"),u=this.getAttribute("show-toolbar")!=="false",d=this.getAttribute("show-today")!=="false";if(!t.length){this.setContent(`
|
|
660
|
+
<style>${ht}</style>
|
|
661
661
|
<section class="frame" part="frame">
|
|
662
662
|
<div class="empty" part="empty">No tasks in this range</div>
|
|
663
663
|
</section>
|
|
664
|
-
`);return}const
|
|
665
|
-
<article class="grid-row${
|
|
666
|
-
<div class="grid-cell task-name" role="gridcell" style="padding-left:${10+
|
|
667
|
-
${
|
|
668
|
-
<span class="name-text" title="${
|
|
664
|
+
`);return}const g=t.map(r=>f(r.start)).filter(r=>r!=null),c=t.map(r=>f(r.end)).filter(r=>r!=null),m=x(Math.min(...g),-2),h=x(Math.max(...c),3),w=Math.max(7,Math.ceil((h-m)/I)),M=gt[e],k=Math.max(680,w*M),A=Math.max(o.length*y,y),z=this.getAttribute("virtualized")!=="false"&&o.length>240,T=Math.max(20,Math.ceil(Math.max(420,this.viewportHeight-W)/y)),R=160,P=Math.max(0,this.viewportTop-W),yt=Math.max(0,Math.floor(P/y)),X=Math.max(180,T*4),L=z?Math.max(0,Math.floor(yt/X)*X-R):0,B=z?Math.min(o.length,L+T+R*2+X):o.length,K=o.slice(L,B),_=L*y,V=Math.max(0,(o.length-B)*y);this.renderedFirstRow=L,this.renderedLastRow=B;const Q=new Map(o.map((r,$)=>[r.id,{task:r,index:$}])),tt=new Set(K.map(r=>r.id)),C=r=>(r-m)/I*M,kt=K.map((r,$)=>{const E=L+$,v=this.selectedId===r.id?" selected":"",F=H(r),G=r.progress==null?"-":`${Math.round(r.progress)}%`,U=F==="milestone"?O(r.startMs):`${O(r.startMs)} - ${O(r.endMs)}`;return`
|
|
665
|
+
<article class="grid-row${v}" part="grid-row" data-task-id="${b(r.id)}" role="row" aria-rowindex="${E+2}" aria-level="${r.depth+1}" ${r.hasChildren?`aria-expanded="${!this.collapsed.has(r.id)}"`:""}>
|
|
666
|
+
<div class="grid-cell task-name" role="gridcell" style="padding-left:${10+r.depth*18}px">
|
|
667
|
+
${r.hasChildren?`<button class="expander" data-action="toggle" data-task-id="${b(r.id)}" aria-label="${this.collapsed.has(r.id)?"Expand":"Collapse"} ${b(r.label)}">${this.collapsed.has(r.id)?"›":"⌄"}</button>`:'<span style="inline-size:22px"></span>'}
|
|
668
|
+
<span class="name-text" title="${b(r.label)}">${b(r.label)}</span>
|
|
669
669
|
</div>
|
|
670
|
-
<div class="grid-cell badge" role="gridcell">${
|
|
671
|
-
<div class="grid-cell badge" role="gridcell">${
|
|
672
|
-
<div class="grid-cell badge" role="gridcell">${
|
|
670
|
+
<div class="grid-cell badge" role="gridcell">${b(r.assignee||F)}</div>
|
|
671
|
+
<div class="grid-cell badge" role="gridcell">${b(U)}</div>
|
|
672
|
+
<div class="grid-cell badge" role="gridcell">${b(G)}</div>
|
|
673
673
|
</article>
|
|
674
|
-
`}).join("")
|
|
675
|
-
<article class="timeline-row${F}" part="timeline-row" data-task-id="${
|
|
676
|
-
${
|
|
674
|
+
`}).join(""),$t=K.map((r,$)=>{const E=L+$,v=H(r),F=this.selectedId===r.id?" selected":"",G=this.selectedId===r.id||!this.selectedId&&E===0,U=mt[r.tone||(v==="summary"?"info":"default")]||mt.default,rt=v==="milestone"?C(r.startMs)-N/2:C(r.startMs),zt=C(v==="milestone"?r.startMs:r.endMs),Ct=v==="milestone"?N:Math.max(12,zt-rt),Tt=Math.max(0,Math.min(100,Number(r.progress??0))),at=!p&&!r.readonly&&v!=="summary",nt=at&&v==="task",it=v==="task"&&r.segments?.length?r.segments.map(st=>{const ot=f(st.start),lt=f(st.end);if(ot==null||lt==null)return"";const dt=Math.max(I,r.endMs-r.startMs),Z=Math.max(r.startMs,ot),ct=Math.min(r.endMs,lt);if(ct<=Z)return"";const pt=Math.max(0,Math.min(100,(Z-r.startMs)/dt*100)),It=(ct-Z)/dt*100,ut=Math.min(100-pt,Math.max(1,It));return ut<=0?"":`<span class="split-segment" style="left:${pt.toFixed(2)}%;width:${ut.toFixed(2)}%"></span>`}).join(""):"";return`
|
|
675
|
+
<article class="timeline-row${F}" part="timeline-row" data-task-id="${b(r.id)}" role="row" aria-rowindex="${E+2}">
|
|
676
|
+
${r.baselineStart&&r.baselineEnd?`<span class="baseline" style="left:${C(f(r.baselineStart)||r.startMs).toFixed(2)}px;width:${Math.max(4,C(f(r.baselineEnd)||r.endMs)-C(f(r.baselineStart)||r.startMs)).toFixed(2)}px"></span>`:""}
|
|
677
677
|
<button
|
|
678
|
-
class="bar ${
|
|
679
|
-
part="bar ${
|
|
680
|
-
data-task-id="${
|
|
681
|
-
data-kind="${
|
|
678
|
+
class="bar ${v}${r.critical?" critical":""}${it?" split":""}"
|
|
679
|
+
part="bar ${v}"
|
|
680
|
+
data-task-id="${b(r.id)}"
|
|
681
|
+
data-kind="${v}"
|
|
682
682
|
role="gridcell"
|
|
683
683
|
tabindex="${G?"0":"-1"}"
|
|
684
|
-
aria-selected="${this.selectedId===
|
|
684
|
+
aria-selected="${this.selectedId===r.id}"
|
|
685
685
|
aria-colindex="5"
|
|
686
|
-
style="left:${rt.toFixed(2)}px;width:${
|
|
687
|
-
aria-label="${
|
|
686
|
+
style="left:${rt.toFixed(2)}px;width:${Ct.toFixed(2)}px;--tone:${U};--progress:${Tt.toFixed(2)}%"
|
|
687
|
+
aria-label="${b(r.label)}"
|
|
688
688
|
${at?'data-draggable="true"':""}
|
|
689
689
|
>
|
|
690
690
|
${nt?'<span class="handle start" data-mode="resize-start"></span>':""}
|
|
691
691
|
<span class="progress"></span>
|
|
692
692
|
${it}
|
|
693
|
-
${
|
|
693
|
+
${v==="milestone"?'<span class="milestone-shape"></span>':""}
|
|
694
694
|
<span class="drag-tip"></span>
|
|
695
695
|
${nt?'<span class="handle end" data-mode="resize-end"></span>':""}
|
|
696
696
|
</button>
|
|
697
697
|
</article>
|
|
698
|
-
`}).join(""),et=
|
|
699
|
-
<style>${
|
|
700
|
-
<section class="frame" part="frame" data-bar-variant="${
|
|
701
|
-
${
|
|
698
|
+
`}).join(""),et=i.map(r=>{const $=Q.get(r.source),E=Q.get(r.target);if(!$||!E||z&&!tt.has(r.source)&&!tt.has(r.target))return"";const v=jt($.task,$.index,E.task,E.index,r.type,C),F=`${$.task.label} dependency to ${E.task.label}`;return`<path class="link-hit" d="${v}" data-link-id="${b(r.id)}" data-source-id="${b(r.source)}" data-target-id="${b(r.target)}" data-link-type="${b(r.type||"e2s")}" aria-label="${b(F)}" /><path d="${v}" />`}).join(""),Mt=et?'<defs><marker id="ui-gantt-arrow" markerWidth="9" markerHeight="9" refX="8.5" refY="4.5" orient="auto" markerUnits="userSpaceOnUse"><path d="M 0.5 0.75 L 8.5 4.5 L 0.5 8.25 z" /></marker></defs>':"",Y=D(Date.now()),Et=C(Y),St=d&&Y>=m&&Y<=h?`<div class="today" part="today" style="left:${Et.toFixed(2)}px"></div>`:"";this.setContent(`
|
|
699
|
+
<style>${ht}</style>
|
|
700
|
+
<section class="frame" part="frame" data-bar-variant="${s}">
|
|
701
|
+
${u?`
|
|
702
702
|
<header class="toolbar" part="toolbar">
|
|
703
|
-
<div class="title">Project schedule <span class="meta">${
|
|
703
|
+
<div class="title">Project schedule <span class="meta">${o.length}/${t.length} tasks</span></div>
|
|
704
704
|
<div class="controls">
|
|
705
|
-
<input class="control" value="${
|
|
705
|
+
<input class="control" value="${b(l)}" placeholder="Filter tasks" aria-label="Filter tasks" />
|
|
706
706
|
<select class="select" aria-label="Sort tasks">
|
|
707
|
-
${[["none","Manual"],["start","Start date"],["end","End date"],["label","Name"],["progress","Progress"]].map(([
|
|
707
|
+
${[["none","Manual"],["start","Start date"],["end","End date"],["label","Name"],["progress","Progress"]].map(([r,$])=>`<option value="${r}" ${n===r?"selected":""}>${$}</option>`).join("")}
|
|
708
708
|
</select>
|
|
709
|
-
${["day","week","month","quarter","year"].map(
|
|
709
|
+
${["day","week","month","quarter","year"].map(r=>`<button class="zoom-button" data-zoom="${r}" aria-pressed="${e===r}">${r}</button>`).join("")}
|
|
710
710
|
</div>
|
|
711
711
|
</header>
|
|
712
712
|
`:""}
|
|
713
713
|
<div class="viewport" part="viewport">
|
|
714
|
-
<div class="surface" part="surface" style="--day-width:${
|
|
714
|
+
<div class="surface" part="surface" style="--day-width:${M}px;grid-template-columns:${J}px ${k.toFixed(2)}px;inline-size:max(100%, ${(J+k).toFixed(2)}px)">
|
|
715
715
|
<header class="grid-head" part="grid-head" role="row">
|
|
716
|
-
<button class="head-button" data-sort="label" role="columnheader" aria-sort="${
|
|
716
|
+
<button class="head-button" data-sort="label" role="columnheader" aria-sort="${n==="label"?"ascending":"none"}">Task</button>
|
|
717
717
|
<span role="columnheader">Owner</span>
|
|
718
|
-
<button class="head-button" data-sort="start" role="columnheader" aria-sort="${
|
|
719
|
-
<button class="head-button" data-sort="progress" role="columnheader" aria-sort="${
|
|
718
|
+
<button class="head-button" data-sort="start" role="columnheader" aria-sort="${n==="start"?"ascending":"none"}">Dates</button>
|
|
719
|
+
<button class="head-button" data-sort="progress" role="columnheader" aria-sort="${n==="progress"?"descending":"none"}">%</button>
|
|
720
720
|
</header>
|
|
721
721
|
<header class="timeline-head" part="timeline-head">
|
|
722
|
-
<div class="scale" style="width:${
|
|
722
|
+
<div class="scale" style="width:${k.toFixed(2)}px">${Ht(m,h,M,e,this.viewportLeft,this.viewportWidth)}</div>
|
|
723
723
|
</header>
|
|
724
|
-
<div class="grid-body" part="grid-body" role="treegrid" aria-rowcount="${
|
|
724
|
+
<div class="grid-body" part="grid-body" role="treegrid" aria-rowcount="${o.length+1}" aria-colcount="4">
|
|
725
725
|
${z&&_?`<div style="height:${_}px"></div>`:""}
|
|
726
|
-
${
|
|
726
|
+
${kt||'<div class="empty">No matching tasks</div>'}
|
|
727
727
|
${z&&V?`<div style="height:${V}px"></div>`:""}
|
|
728
728
|
</div>
|
|
729
|
-
<div class="timeline-body" part="timeline-body" style="width:${
|
|
730
|
-
<svg class="links" width="${
|
|
731
|
-
${
|
|
729
|
+
<div class="timeline-body" part="timeline-body" style="width:${k.toFixed(2)}px;min-height:${A}px">
|
|
730
|
+
<svg class="links" width="${k.toFixed(0)}" height="${A}" viewBox="0 0 ${k.toFixed(0)} ${A}" aria-hidden="true">${Mt}${et}</svg>
|
|
731
|
+
${St}
|
|
732
732
|
${z&&_?`<div style="height:${_}px"></div>`:""}
|
|
733
|
-
${
|
|
733
|
+
${$t}
|
|
734
734
|
${z&&V?`<div style="height:${V}px"></div>`:""}
|
|
735
735
|
</div>
|
|
736
736
|
</div>
|
|
737
737
|
</div>
|
|
738
738
|
</section>
|
|
739
|
-
`);const q=this.root.querySelector(".viewport");q&&(q.scrollTop=this.viewportTop,q.scrollLeft=this.viewportLeft,this.viewportWidth=q.clientWidth||this.viewportWidth,this.viewportHeight=q.clientHeight||this.viewportHeight),this.bindEvents()}bindEvents(){
|
|
739
|
+
`);const q=this.root.querySelector(".viewport");q&&(q.scrollTop=this.viewportTop,q.scrollLeft=this.viewportLeft,this.viewportWidth=q.clientWidth||this.viewportWidth,this.viewportHeight=q.clientHeight||this.viewportHeight),this.bindEvents()}bindEvents(){this.root.querySelectorAll("[data-task-id]").forEach(t=>{t.addEventListener("click",i=>{const e=i.target,n=i.currentTarget;if(!n.classList.contains("bar")&&e.closest(".bar"))return;if(this.drag?.moved){i.stopPropagation();return}const l=i.currentTarget.dataset.taskId;l&&(e.closest('[data-action="toggle"]')||(n.classList.contains("bar")&&i.stopPropagation(),this.selectTask(l)))})}),this.root.querySelectorAll('[data-action="toggle"]').forEach(t=>{t.addEventListener("click",i=>{i.stopPropagation();const e=t.dataset.taskId;e&&(this.collapsed.has(e)?this.collapsed.delete(e):this.collapsed.add(e),this.requestRender())})}),this.root.querySelectorAll("[data-zoom]").forEach(t=>{t.addEventListener("click",()=>{const i=t.dataset.zoom||"week";this.setAttribute("zoom",i),this.dispatchEvent(new CustomEvent("zoomchange",{detail:{zoom:i},bubbles:!0,composed:!0}))})}),this.root.querySelectorAll(".head-button[data-sort]").forEach(t=>{t.addEventListener("click",()=>{const i=j(t.dataset.sort||null);i==="none"?this.removeAttribute("sort"):this.setAttribute("sort",i),this.dispatchEvent(new CustomEvent("sortchange",{detail:{sort:i},bubbles:!0,composed:!0}))})}),this.root.querySelector(".viewport")?.addEventListener("scroll",t=>{const i=t.currentTarget,e=i.scrollTop,n=i.scrollLeft,s=Math.max(20,Math.ceil(Math.max(420,this.viewportHeight-W)/y)),l=Math.max(0,Math.floor(Math.max(0,e-W)/y)),o=l<this.renderedFirstRow+64||l+s>this.renderedLastRow-64,p=Math.abs(n-this.viewportLeft)>=Math.max(480,this.viewportWidth*.6);this.viewportTop=e,this.viewportLeft=n,!(!o&&!p)&&this.scrollFrame==null&&(this.scrollFrame=window.setTimeout(()=>{this.scrollFrame=null,this.requestRender()},24))},{passive:!0}),this.root.querySelector(".control")?.addEventListener("input",t=>{this.internalFilter=t.currentTarget.value,this.dispatchEvent(new CustomEvent("filterchange",{detail:{filter:this.internalFilter},bubbles:!0,composed:!0})),this.requestRender()}),this.root.querySelector(".select")?.addEventListener("change",t=>{const i=j(t.currentTarget.value);i==="none"?this.removeAttribute("sort"):this.setAttribute("sort",i),this.dispatchEvent(new CustomEvent("sortchange",{detail:{sort:i},bubbles:!0,composed:!0}))}),this.root.querySelectorAll(".link-hit").forEach(t=>{t.addEventListener("click",i=>{i.stopPropagation(),this.dispatchEvent(new CustomEvent("linkselect",{detail:{id:t.dataset.linkId||"",source:t.dataset.sourceId||"",target:t.dataset.targetId||"",type:t.dataset.linkType||"e2s"},bubbles:!0,composed:!0}))})}),!this.hasAttribute("readonly")&&this.root.querySelectorAll('.bar[data-draggable="true"]').forEach(t=>{t.addEventListener("pointerdown",e=>{if(e.button!==0)return;const n=t.dataset.taskId;if(!n)return;const l=this.getTasks().find(h=>h.id===n),o=f(l?.start),p=f(l?.end);if(!l||o==null||p==null)return;e.preventDefault();const u=t.dataset.kind||"task",d=e.target.dataset.mode||"move",g=u==="milestone"?"move":d,c=bt(this.getAttribute("zoom")),m=this.selectedId!==n;this.selectedId=n,this.dispatchEvent(new CustomEvent("taskselect",{detail:{id:n},bubbles:!0,composed:!0})),this.drag={taskId:n,mode:g,startX:e.clientX,originalStart:o,originalEnd:p,kind:u,rangeMin:this.rangeMin(),dayWidth:gt[c],latestStart:o,latestEnd:p,frame:null,bar:t,moved:!1,selectedChanged:m},t.classList.add("dragging"),t.setPointerCapture(e.pointerId)}),t.addEventListener("pointermove",e=>{if(!this.drag||this.drag.taskId!==t.dataset.taskId)return;e.preventDefault();const n=e.clientX-this.drag.startX;Math.abs(n)>2&&(this.drag.moved=!0);let s=this.drag.originalStart,l=this.drag.originalEnd;if(this.drag.mode==="move"){const o=Math.round(n/this.drag.dayWidth);s=x(this.drag.originalStart,o),l=this.drag.kind==="milestone"?s:x(this.drag.originalEnd,o)}else if(this.drag.mode==="resize-start"){const o=Math.round(n/this.drag.dayWidth);s=Math.min(x(this.drag.originalStart,o),x(l,-1))}else{const o=Math.round(n/this.drag.dayWidth);l=Math.max(x(this.drag.originalEnd,o),x(s,1))}this.drag.latestStart=s,this.drag.latestEnd=l,this.drag.frame==null&&(this.drag.frame=requestAnimationFrame(()=>{if(!this.drag)return;this.drag.frame=null;const o=(this.drag.latestStart-this.drag.rangeMin)/I*this.drag.dayWidth-(this.drag.kind==="milestone"?N/2:0),p=this.drag.kind==="milestone"?N:Math.max(12,(this.drag.latestEnd-this.drag.latestStart)/I*this.drag.dayWidth);this.drag.bar.style.left=`${o.toFixed(2)}px`,this.drag.bar.style.width=`${p.toFixed(2)}px`;const u=this.drag.bar.querySelector(".drag-tip");u&&(u.textContent=this.drag.kind==="milestone"?S(this.drag.latestStart):`${S(this.drag.latestStart)} - ${S(this.drag.latestEnd)}`)}))});const i=()=>{if(!this.drag)return;this.drag.frame!=null&&cancelAnimationFrame(this.drag.frame);const e=this.drag;if(e.bar.classList.remove("dragging"),this.drag=null,!e.moved){e.selectedChanged&&this.requestRender();return}const n={id:e.taskId,start:S(e.latestStart),end:S(e.latestEnd)};this.overrides.set(e.taskId,{start:n.start,end:n.end}),this.bumpOverrides(),this.dispatchEvent(new CustomEvent("taskchange",{detail:n,bubbles:!0,composed:!0})),this.requestRender()};t.addEventListener("pointerup",i),t.addEventListener("pointercancel",i),t.addEventListener("keydown",e=>{const n=t.dataset.taskId;if(!n)return;if(e.key==="Delete"||e.key==="Backspace"){e.preventDefault(),this.dispatchEvent(new CustomEvent("taskdelete",{detail:{id:n},bubbles:!0,composed:!0}));return}if(e.key==="Enter"||e.key===" "){e.preventDefault(),this.selectTask(n);return}if(e.key==="ArrowUp"||e.key==="ArrowDown"){e.preventDefault(),this.selectAdjacentTask(n,e.key==="ArrowDown"?1:-1);return}if(e.key!=="ArrowLeft"&&e.key!=="ArrowRight")return;const l=this.getTasks().find(h=>h.id===n),o=f(l?.start),p=f(l?.end);if(!l||o==null||p==null)return;e.preventDefault();const u=e.key==="ArrowLeft"?-1:1,d=t.dataset.kind==="milestone",g=e.shiftKey&&!d?o:x(o,u),c=d?g:e.shiftKey?Math.max(x(p,u),x(o,1)):x(p,u),m={id:n,start:S(g),end:S(c)};this.overrides.set(n,{start:m.start,end:m.end}),this.bumpOverrides(),this.dispatchEvent(new CustomEvent("taskchange",{detail:m,bubbles:!0,composed:!0})),this.requestRender()})})}rangeMin(){const i=this.getTasks().map(e=>f(e.start)).filter(e=>e!=null);return i.length?x(Math.min(...i),-2):D(Date.now())}selectTask(t){if(this.captureViewport(),this.selectedId===t){this.dispatchEvent(new CustomEvent("taskselect",{detail:{id:t},bubbles:!0,composed:!0}));return}this.selectedId=t,this.dispatchEvent(new CustomEvent("taskselect",{detail:{id:t},bubbles:!0,composed:!0})),this.requestRender()}selectAdjacentTask(t,i){const e=this.getVisibleTasks(this.getTasks(),this.getAttribute("filter")??this.internalFilter,j(this.getAttribute("sort"))),n=e.findIndex(l=>l.id===t),s=e[Math.max(0,Math.min(e.length-1,n+i))];!s||s.id===t||(this.selectedId=s.id,this.dispatchEvent(new CustomEvent("taskselect",{detail:{id:s.id},bubbles:!0,composed:!0})),this.requestRender(),window.requestAnimationFrame(()=>{this.root.querySelector(`.bar[data-task-id="${CSS.escape(s.id)}"]`)?.focus()}))}captureViewport(){const t=this.root.querySelector(".viewport");t&&(this.viewportTop=t.scrollTop,this.viewportLeft=t.scrollLeft,this.viewportWidth=t.clientWidth||this.viewportWidth,this.viewportHeight=t.clientHeight||this.viewportHeight)}getTasks(){const t=this.getAttribute("tasks");return t===this.taskCacheRaw&&this.taskCacheVersion===this.overridesVersion?this.taskCache:(this.taskCacheRaw=t,this.taskCacheVersion=this.overridesVersion,this.taskCache=Dt(t,this.overrides),this.visibleCacheKey="",this.taskCache)}getLinks(){const t=this.getAttribute("links");return t===this.linkCacheRaw?this.linkCache:(this.linkCacheRaw=t,this.linkCache=Rt(t),this.linkCache)}getVisibleTasks(t,i,e){const n=Array.from(this.collapsed).sort().join(","),s=`${this.taskCacheRaw||""}|${this.overridesVersion}|${i}|${e}|${n}`;return s===this.visibleCacheKey?this.visibleCache:(this.visibleCacheKey=s,this.visibleCache=Nt(t,this.collapsed,i,e),this.visibleCache)}bumpOverrides(){this.overridesVersion+=1,this.taskCacheVersion=-1,this.visibleCacheKey=""}shouldRenderOnAttributeChange(t,i,e){return t==="tasks"&&(this.overrides.clear(),this.bumpOverrides(),this.viewportTop=0,this.viewportLeft=0),t==="links"&&(this.linkCacheRaw=null),!0}}typeof customElements<"u"&&!customElements.get("ui-gantt")&&customElements.define("ui-gantt",wt);exports.UIGantt=wt;
|