@dooboostore/dom-render 1.0.108 → 1.0.109
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/README.MD +27 -1451
- package/dist/cjs/DomRender.js +41 -26
- package/dist/cjs/DomRender.js.map +2 -2
- package/dist/cjs/DomRenderProxy.js +12 -5
- package/dist/cjs/DomRenderProxy.js.map +2 -2
- package/dist/cjs/bundle-entry.js +32 -21
- package/dist/cjs/bundle-entry.js.map +2 -2
- package/dist/cjs/components/ComponentBase.js +20 -2
- package/dist/cjs/components/ComponentBase.js.map +2 -2
- package/dist/cjs/components/ComponentRouterBase.js +11 -1
- package/dist/cjs/components/ComponentRouterBase.js.map +2 -2
- package/dist/cjs/components/choose/Choose.js +4 -0
- package/dist/cjs/components/choose/Choose.js.map +2 -2
- package/dist/cjs/components/router/RouterOutlet.js +15 -1
- package/dist/cjs/components/router/RouterOutlet.js.map +2 -2
- package/dist/cjs/components/select/Select.js +20 -6
- package/dist/cjs/components/select/Select.js.map +2 -2
- package/dist/cjs/components/timer/Timer.js +14 -11
- package/dist/cjs/components/timer/Timer.js.map +2 -2
- package/dist/cjs/decorators/DomRenderNoProxy.js +2 -1
- package/dist/cjs/decorators/DomRenderNoProxy.js.map +2 -2
- package/dist/cjs/lifecycle/OnRawSetRendered.js +26 -0
- package/dist/cjs/lifecycle/OnRawSetRendered.js.map +7 -0
- package/dist/cjs/lifecycle/index.js +1 -0
- package/dist/cjs/lifecycle/index.js.map +2 -2
- package/dist/cjs/operators/DrTargetElement.js +2 -0
- package/dist/cjs/operators/DrTargetElement.js.map +2 -2
- package/dist/cjs/operators/OperatorExecuter.js +1 -2
- package/dist/cjs/operators/OperatorExecuter.js.map +2 -2
- package/dist/cjs/package.json +5 -0
- package/dist/cjs/rawsets/RawSet.js +154 -74
- package/dist/cjs/rawsets/RawSet.js.map +3 -3
- package/dist/cjs/rawsets/Render.js.map +1 -1
- package/dist/cjs/routers/Router.js +31 -15
- package/dist/cjs/routers/Router.js.map +3 -3
- package/dist/esm/DomRender.js +41 -26
- package/dist/esm/DomRender.js.map +2 -2
- package/dist/esm/DomRenderProxy.js +12 -5
- package/dist/esm/DomRenderProxy.js.map +2 -2
- package/dist/esm/bundle-entry.js +22 -21
- package/dist/esm/bundle-entry.js.map +2 -2
- package/dist/esm/components/ComponentBase.js +20 -2
- package/dist/esm/components/ComponentBase.js.map +2 -2
- package/dist/esm/components/ComponentRouterBase.js +11 -1
- package/dist/esm/components/ComponentRouterBase.js.map +2 -2
- package/dist/esm/components/choose/Choose.js +4 -0
- package/dist/esm/components/choose/Choose.js.map +2 -2
- package/dist/esm/components/router/RouterOutlet.js +16 -2
- package/dist/esm/components/router/RouterOutlet.js.map +2 -2
- package/dist/esm/components/select/Select.js +20 -6
- package/dist/esm/components/select/Select.js.map +2 -2
- package/dist/esm/components/timer/Timer.js +14 -11
- package/dist/esm/components/timer/Timer.js.map +2 -2
- package/dist/esm/decorators/DomRenderNoProxy.js +2 -1
- package/dist/esm/decorators/DomRenderNoProxy.js.map +2 -2
- package/dist/esm/lifecycle/OnRawSetRendered.js +7 -0
- package/dist/esm/lifecycle/OnRawSetRendered.js.map +7 -0
- package/dist/esm/lifecycle/index.js +1 -0
- package/dist/esm/lifecycle/index.js.map +2 -2
- package/dist/esm/operators/DrTargetElement.js +2 -0
- package/dist/esm/operators/DrTargetElement.js.map +2 -2
- package/dist/esm/operators/OperatorExecuter.js +1 -2
- package/dist/esm/operators/OperatorExecuter.js.map +2 -2
- package/dist/esm/rawsets/RawSet.js +154 -74
- package/dist/esm/rawsets/RawSet.js.map +3 -3
- package/dist/esm/routers/Router.js +31 -15
- package/dist/esm/routers/Router.js.map +3 -3
- package/dist/esm-bundle/dooboostore-dom-render.esm.js +12586 -6496
- package/dist/esm-bundle/dooboostore-dom-render.esm.js.map +4 -4
- package/dist/types/DomRender.d.ts +11 -5
- package/dist/types/DomRender.d.ts.map +1 -1
- package/dist/types/DomRenderProxy.d.ts.map +1 -1
- package/dist/types/bundle-entry.d.ts +5 -2
- package/dist/types/bundle-entry.d.ts.map +1 -1
- package/dist/types/components/ComponentBase.d.ts +7 -1
- package/dist/types/components/ComponentBase.d.ts.map +1 -1
- package/dist/types/components/ComponentRouterBase.d.ts +8 -0
- package/dist/types/components/ComponentRouterBase.d.ts.map +1 -1
- package/dist/types/components/choose/Choose.d.ts.map +1 -1
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/components/index.d.ts.map +1 -1
- package/dist/types/components/router/RouterOutlet.d.ts +5 -1
- package/dist/types/components/router/RouterOutlet.d.ts.map +1 -1
- package/dist/types/components/select/Select.d.ts +2 -2
- package/dist/types/components/select/Select.d.ts.map +1 -1
- package/dist/types/components/timer/Timer.d.ts +5 -3
- package/dist/types/components/timer/Timer.d.ts.map +1 -1
- package/dist/types/decorators/DomRenderNoProxy.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lifecycle/OnRawSetRendered.d.ts +10 -0
- package/dist/types/lifecycle/OnRawSetRendered.d.ts.map +1 -0
- package/dist/types/lifecycle/index.d.ts +1 -0
- package/dist/types/lifecycle/index.d.ts.map +1 -1
- package/dist/types/operators/DrTargetElement.d.ts.map +1 -1
- package/dist/types/operators/OperatorExecuter.d.ts.map +1 -1
- package/dist/types/rawsets/RawSet.d.ts +11 -4
- package/dist/types/rawsets/RawSet.d.ts.map +1 -1
- package/dist/types/rawsets/Render.d.ts +1 -0
- package/dist/types/rawsets/Render.d.ts.map +1 -1
- package/dist/types/routers/Router.d.ts +2 -3
- package/dist/types/routers/Router.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-dom-render.umd.js +12600 -6529
- package/dist/umd-bundle/dooboostore-dom-render.umd.js.map +4 -4
- package/package.json +6 -5
- package/src/DomRender.ts +62 -34
- package/src/DomRenderProxy.ts +20 -8
- package/src/bundle-entry.ts +5 -3
- package/src/components/ComponentBase.ts +29 -7
- package/src/components/ComponentRouterBase.ts +17 -2
- package/src/components/choose/Choose.ts +4 -0
- package/src/components/router/RouterOutlet.ts +25 -5
- package/src/components/select/Select.ts +40 -26
- package/src/components/timer/Timer.ts +19 -51
- package/src/decorators/DomRenderNoProxy.ts +3 -1
- package/src/lifecycle/OnRawSetRendered.ts +15 -0
- package/src/lifecycle/index.ts +1 -0
- package/src/operators/DrTargetElement.ts +14 -0
- package/src/operators/OperatorExecuter.ts +1 -2
- package/src/rawsets/RawSet.ts +572 -257
- package/src/rawsets/Render.ts +1 -0
- package/src/routers/Router.ts +40 -23
- package/types.d.ts +68 -20
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/select/Select.ts"],
|
|
4
|
-
"sourcesContent": ["import { attribute, ChildrenSet, ComponentBase } from '../ComponentBase';\nimport { DomRender, DomRenderRunConfig } from '../../DomRender';\nimport { RawSet } from '../../rawsets/RawSet';\nimport { OnCreateRenderData, OnCreateRenderDataParams } from '../../lifecycle/OnCreateRenderData';\nimport { OnInitRender } from '../../lifecycle/OnInitRender';\nimport { OnDestroyRender } from '../../lifecycle/OnDestroyRender';\nimport { EventUtils } from '@dooboostore/core-web/event/EventUtils';\nimport { type Subscription } from '@dooboostore/core/message/Subscription';\nimport { ValidUtils } from '@dooboostore/core-web/valid/ValidUtils';\nimport { DomRenderNoProxy } from '../../decorators/DomRenderNoProxy';\nimport { OnCreateRender } from '../../lifecycle/OnCreateRender';\nimport { DomRenderConfig } from '../../configs/DomRenderConfig';\nimport { WindowUtils } from '@dooboostore/core-web/window/WindowUtils';\n\n/** 사용법\n <dr-select class=\"card-select-container\" changeSelected=\"${(data) => @this@.changeSelected(data)}$\"> <!-- multiple attribute optional-->\n <dr-select-summary class=\"card-select-summary-container\">\n <dr-select-summary-placeholder>\n <div class=\"card-select-summary-placeholder-container\">카드사별 사용처 안내 페이지 선택</div>\n </dr-select-summary-placeholder>\n <dr-select-summary-selected>\n <div dr-if=\"@this@.selectedCard\" class=\"card-select-summary-selected-container\">\n <img dr-attr=\"{src:@this@.selectedCard?.iconImg}\"> ${@this@.selectedCard?.name}$\n </div>\n </dr-select-summary-selected>\n </dr-select-summary>\n\n <dr-select-body float=\"bottom-left\" class=\"card-select-body-container\">\n <dr-select-option dr-for-of=\"@this@.cards\" value=\"${#it#.name}$\" selected=\"${#nearForOfIndex# === 0}$\" class=\"card-select-body-option-container\">\n <img dr-attr=\"{src:#it#.iconImg}\"> ${#it#.name}$\n </dr-select-option>\n </dr-select-body>\n </dr-select>\n */\n\nexport namespace Select {\n export const selector = 'dr-select';\n\n // Base for simple hide/show components\n class StateComponent extends ComponentBase {\n public hidden = true;\n public value: string | null = null;\n\n constructor(config: any) {\n super(config);\n }\n\n setValue(value: string | null) {\n this.value = value;\n }\n }\n\n // --- Option Child Components ---\n export class OptionSelected extends StateComponent {\n constructor() {\n super({onlyParentType: Option});\n }\n }\n\n export class OptionUnselected extends StateComponent {\n constructor() {\n super({onlyParentType: Option});\n }\n }\n\n export class OptionDisabled extends StateComponent {\n constructor() {\n super({onlyParentType: Option});\n }\n }\n\n // --- Summary Child Components ---\n export class SummaryPlaceholder extends StateComponent {\n constructor() {\n super({onlyParentType: Summary});\n }\n }\n\n export class SummarySelected extends StateComponent {\n private selectedOptions: Select.Option[] = [];\n\n constructor() {\n super({onlyParentType: Summary});\n }\n\n setOptions(options: Option[] = []) {\n this.selectedOptions = options.filter(it => it.selected);\n }\n }\n\n export class SummaryDisabled extends StateComponent {\n private selectedOptions: Select.Option[] = [];\n\n constructor() {\n super({onlyParentType: Summary});\n }\n\n setOptions(options: Option[] = []) {\n this.selectedOptions = options.filter(it => it.selected);\n }\n }\n\n // --- Select Body Component ---\n export type SelectBodyAttribute = {\n float?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';\n class?: string;\n }\n // --- Option Component ---\n export type OptionAttribute = { value: string; selected?: boolean | null; disabled?: boolean | null; class?: string; };\n\n export class Option extends ComponentBase<OptionAttribute> implements OnInitRender {\n public hidden = true;\n @attribute({name: 'value'}) public value: string | null = null;\n @attribute({name: 'selected', converter: v => v !== null && v === true}) public selected = false;\n @attribute({name: 'disabled', converter: v => v !== null && v === true}) public disabled = false;\n @attribute({name: 'class', converter: v => (v ? v : null)}) public classAttr: string | null = null;\n\n // public status: 'selected' | 'unselected' | 'disabled' = 'unselected';\n\n constructor() {\n super({onlyParentType: SelectBody});\n }\n\n onInitRender(param: any, rawSet: RawSet) {\n super.onInitRender(param, rawSet);\n // console.log('-----', this.value, this.selected)\n // this.getElement()?.addEventListener('click', (e) => {\n // e.stopPropagation();\n // if (!this.disabled) {\n // this.getParentThis<Select>().handleOptionClick(this);\n // }\n // });\n this.updateStatus();\n }\n\n // onCreatedThisChild(child: any, data: OnCreateRenderDataParams) {\n // super.onCreatedThisChild(child, data);\n // this.updateStatus();\n // }\n onCreatedThisChildDebounce(childrenSet: ChildrenSet[]) {\n super.onCreatedThisChildDebounce(childrenSet);\n this.updateStatus();\n }\n\n toggleSelected(event: Event) {\n // console.log('isMultiple', this.isMultiple())\n if (!this.disabled) {\n this.selected = this.isMultiple()? !this.selected : true;\n // this.selected = !this.selected;\n this.updateStatus();\n this.getParentThis<SelectBody>().changeOptionState(this);\n } else {\n event.stopPropagation();\n event.preventDefault();\n }\n }\n\n isMultiple() {\n return this.getParentThis<Select.SelectBody>()?.getParentThis<Select.Select>().multiple;\n }\n\n updateStatus() {\n if (this.disabled) {\n this.getChildren(OptionSelected).forEach(c => {\n c.hidden = true;\n c.setValue(this.value)\n });\n this.getChildren(OptionUnselected).forEach(c => {\n c.hidden = true;\n c.setValue(this.value)\n });\n this.getChildren(OptionDisabled).forEach(c => {\n c.hidden = false;\n c.setValue(this.value)\n });\n return;\n }\n\n if (this.selected) {\n this.getChildren(OptionSelected).forEach(c => {\n c.hidden = false;\n c.setValue(this.value)\n });\n this.getChildren(OptionUnselected).forEach(c => {\n c.hidden = true;\n c.setValue(this.value)\n });\n this.getChildren(OptionDisabled).forEach(c => {\n c.hidden = true;\n c.setValue(this.value)\n });\n }\n\n if (!this.selected) {\n this.getChildren(OptionSelected).forEach(c => {\n c.hidden = true;\n c.setValue(this.value)\n });\n this.getChildren(OptionUnselected).forEach(c => {\n c.hidden = false;\n c.setValue(this.value)\n });\n this.getChildren(OptionDisabled).forEach(c => {\n c.hidden = true;\n c.setValue(this.value)\n });\n }\n }\n }\n\n // --- Summary Component ---\n export class Summary extends ComponentBase implements OnInitRender {\n @attribute({name: 'class', converter: v => (v === '' ? null : v)}) public classAttr: string | null = null;\n private options: Select.Option[] = [];\n private disabled: boolean = false;\n public element?: HTMLElement;\n\n constructor() {\n super({onlyParentType: Select});\n }\n\n\n setDisabled(disabled: boolean) {\n this.disabled = disabled;\n this.getChildren(SummaryPlaceholder).forEach(it => it.hidden = true);\n this.getChildren(SummarySelected).forEach(it => it.hidden = true);\n this.getChildren(SummaryDisabled).forEach(it => it.hidden = false);\n\n }\n\n setOptions(options: Option[] = []): void {\n this.options = options;\n\n const selectedOptions = this.options.filter(it => it.selected && !it.disabled);\n if (!this.disabled) {\n if (selectedOptions.length > 0) {\n this.getChildren(SummaryPlaceholder).forEach(it => it.hidden = true);\n this.getChildren(SummarySelected).forEach(c => {\n c.setOptions(options);\n c.hidden = false;\n });\n this.getChildren(SummaryDisabled).forEach(it => it.hidden = true);\n } else {\n this.getChildren(SummaryDisabled).forEach(it => it.hidden = true);\n this.getChildren(SummaryPlaceholder).forEach(it => it.hidden = false);\n this.getChildren(SummarySelected).forEach(c => c.hidden = true);\n }\n }\n }\n\n onInitRender(param: any, rawSet: RawSet) {\n super.onInitRender(param, rawSet);\n // this.getElement()?.addEventListener('click', (e) => {\n // e.stopPropagation();\n // this.getParentThis<Select>().toggle();\n // });\n }\n\n onInitSummaryElement(element: HTMLElement, event: Event) {\n this.element = element;\n }\n\n updateView(hasSelection: boolean) {\n this.getChildren(SummaryPlaceholder).forEach(c => c.hidden = hasSelection);\n this.getChildren(SummarySelected).forEach(c => c.hidden = !hasSelection);\n }\n\n // onCreatedThisChild(child: any, data: OnCreateRenderDataParams) {\n // super.onCreatedThisChild(child, data);\n // }\n onCreatedThisChildDebounce(childrenSet: ChildrenSet[]) {\n super.onCreatedThisChildDebounce(childrenSet);\n this.updateView(this.getParentThis<Select>()?.selectedValues.length > 0);\n }\n\n\n onSummaryClick(element: HTMLElement, event: Event) {\n if (this.getParentThis<Select>()?.disabled) {\n event.stopPropagation();\n event.preventDefault();\n return;\n }\n }\n }\n\n\n export class SelectBody extends ComponentBase<SelectBodyAttribute> {\n @attribute({name: 'class', converter: v => (v === '' ? null : v)}) public classAttr: string | null = null;\n @attribute({name: 'float'}) public float: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' | null = null;\n\n constructor() {\n super({onlyParentType: Select});\n }\n\n onCreatedThisChildDebounce(childrenSet: ChildrenSet[]) {\n this.changeOptionState();\n }\n\n changeOptionState(option?: Option) {\n const options = this.getChildren(Option);\n const select = this.getParentThis<Select>();\n // // 멀티플이 아닐때에는 마지막 선택된값으로 처리\n if (!select.multiple) {\n // 내가 선택한게 있으면\n if (option && option.selected) {\n options.filter(it => it !== option).forEach(it => it.selected = false);\n } else {\n const selectedOptions = options.filter(it => it.selected && !it.disabled)\n selectedOptions.forEach((opt, idx) => {\n const isLast = idx === selectedOptions.length - 1;\n if (!isLast) {\n opt.selected = false;\n }\n });\n }\n }\n // console.log('--------', options.map(it=>it.selected))\n select?.setOptions(options);\n }\n }\n\n\n // --- Main Select Component ---\n export type SelectAttribute = {\n multiple?: boolean | null; class?: string;\n changeSelected?: (value: (string | null)[]) => void;\n name?: string;\n float?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';\n disableOtherClickClose?: boolean;\n toggle?: (open: boolean) => void;\n disabled?: boolean | null;\n };\n\n export class Select extends ComponentBase<SelectAttribute> implements OnInitRender, OnCreateRender, OnCreateRenderData, OnDestroyRender {\n @attribute({name: 'multiple', converter: v => v !== null}) public multiple = false;\n @attribute({name: 'disabled', converter: v => v !== null}) public disabled = false;\n @attribute({name: 'class', converter: v => (v === '' ? null : v)}) public classAttr: string | null = null;\n @attribute({name: 'name', converter: v => (v === '' ? null : v)}) public name: string | null = null;\n\n // public isOpen = false;\n public selectedValues: (string | null)[] = [];\n public selectedOptions: Option[] = [];\n public value: string | (string | null)[] | null | undefined;\n\n @DomRenderNoProxy private element?: HTMLDetailsElement;\n @DomRenderNoProxy private documentClickSubscription?: Subscription;\n @DomRenderNoProxy private windowBlurSubscription?: Subscription;\n @DomRenderNoProxy public summaryComponent?: Summary;\n @DomRenderNoProxy public selectBodyComponent?: SelectBody;\n private options?: Select.Option[];\n\n constructor(config?: DomRenderConfig) {\n super();\n // console.log('----Select constructor')\n }\n\n get optionComponents(): Option[] {\n return this.getChildren(Option);\n }\n\n onCreateRender() {\n\n }\n\n onCreateRenderData() {\n\n }\n\n onInitRender(param: any, rawSet: RawSet) {\n super.onInitRender(param, rawSet);\n // console.log('select onInitRender', this.multiple)\n\n if (ValidUtils.isBrowser() && this.rawSet?.dataSet.config.window) {\n const detailsElement = this.element;\n\n const window = this.rawSet.dataSet!.config!.window!;\n const document = window.document;\n this.documentClickSubscription = EventUtils.htmlElementEventObservable(document, 'click').subscribe(event => {\n const isSummaryClick = this.getChildren(Summary).some(it => event.target && it.element?.contains(event.target as Node) || it.element === event.target)\n if (!isSummaryClick && this.getAttribute('disableOtherClickClose')) {\n return;\n }\n if (!isSummaryClick && !this.multiple && detailsElement) {\n detailsElement.open = false;\n return;\n }\n if (!isSummaryClick && detailsElement && !detailsElement?.contains(event?.target as Node)) {\n detailsElement.open = false;\n }\n })\n\n this.windowBlurSubscription = WindowUtils.eventObservable(window, 'blur').subscribe(() => {\n if (detailsElement?.open && window.document.activeElement?.tagName === 'IFRAME') {\n detailsElement.open = false;\n }\n });\n }\n }\n\n\n toggle(element: HTMLDetailsElement, event: Event) {\n // console.log('------>', this.disabled, event)\n // if (this.disabled) {\n // event.stopPropagation();\n // event.preventDefault();\n // return;\n // }\n const toggleAttribute = this.getAttribute('toggle');\n if (toggleAttribute) {\n toggleAttribute?.(element.open);\n }\n }\n\n setOptions(options: Option[]) {\n const summaries = this.getChildren(Summary);\n\n this.options = options;\n\n const values = this.options.filter(it => it.selected && !it.disabled).map(it => it.value)\n this.getAttribute('changeSelected')?.(values);\n summaries?.forEach(it => {\n it.setDisabled(this.disabled);\n if (!this.disabled) {\n it.setOptions(options);\n }\n })\n }\n\n onInitDetailsElement(detailsElement: HTMLDetailsElement) {\n // console.log('detailsElement oninit', detailsElement);\n this.element = detailsElement;\n }\n\n onDrThisUnBind() {\n super.onDrThisUnBind();\n this.onDestroyRender();\n }\n\n onDestroyRender() {\n super.onDestroyRender();\n this.documentClickSubscription?.unsubscribe();\n this.windowBlurSubscription?.unsubscribe();\n }\n\n test() {\n console.log('tttttttt')\n }\n }\n}\n\nconst stateComponentFactory = (name: string, type: any) => {\n return (config?: DomRenderRunConfig) =>\n RawSet.createComponentTargetElement({\n name,\n template: '<div dr-if=\"!@this@.hidden\" dr-option-strip=\"true\">#innerHTML#</div>\\n',\n objFactory: (e, o, r2, constructorParam) => DomRender.run({ rootObject: new type(), config })\n });\n};\n\nexport default {\n select: (config?: DomRenderConfig) => {\n return RawSet.createComponentTargetElement({\n name: Select.selector,\n styles:\n '.dr-select-container {\\n' +\n ' /*position: relative;*/\\n' +\n '\\n' +\n '}\\n' +\n '.dr-select-options-container {\\n' +\n ' display: none;\\n' +\n ' position: absolute;\\n' +\n ' top: 100%;\\n' +\n ' left: 0;\\n' +\n ' right: 0;\\n' +\n ' z-index: 10;\\n' +\n '}\\n' +\n '.dr-select-container.is-open .dr-select-options-container {\\n' +\n ' display: block;\\n' +\n '}\\n' +\n 'summary::-webkit-details-marker {\\n' +\n ' display: none;\\n' +\n '}\\n' +\n '/* Floating styles for dr-select-body */\\n' +\n '.dr-select-body-container {\\n' +\n ' position: absolute;\\n' +\n '}\\n' +\n '\\n' +\n '.dr-select-body-bottom-left-container {\\n' +\n ' position: absolute;\\n' +\n ' left: 0;\\n' +\n ' top: 100%;\\n' +\n '}\\n' +\n '\\n' +\n '.dr-select-body-bottom-right-container {\\n' +\n ' position: absolute;\\n' +\n ' right: 0;\\n' +\n ' top: 100%;\\n' +\n '}\\n' +\n '\\n' +\n '.dr-select-body-top-left-container {\\n' +\n ' position: absolute;\\n' +\n ' left: 0;\\n' +\n ' bottom: 100%;\\n' +\n '}\\n' +\n '\\n' +\n '.dr-select-body-top-right-container {\\n' +\n ' position: absolute;\\n' +\n ' right: 0;\\n' +\n ' bottom: 100%;\\n' +\n '}\\n' +\n '\\n' +\n '/* Reset default details/summary styles */\\n' +\n '.dr-select-container details {\\n' +\n ' display: block; /* Ensure it behaves like a block element */\\n' +\n '}\\n' +\n '\\n' +\n '.dr-select-container summary {\\n' +\n ' display: block; /* Ensure it behaves like a block element */\\n' +\n ' list-style: none; /* Remove default marker */\\n' +\n \" cursor: pointer; /* Indicate it's clickable */\\n\" +\n '}\\n' +\n '\\n' +\n '.dr-select-container summary::-webkit-details-marker,\\n' +\n '.dr-select-container summary::marker {\\n' +\n ' display: none; /* Hide marker for Webkit and standard */\\n' +\n '}',\n template:\n '<details dr-class=\"{\\n' +\n \" 'dr-select-container': true,\\n\" +\n \" 'is-open': @this@.isOpen,\\n\" +\n ' [@this@.classAttr]: @this@.classAttr\\n' +\n ' }\" dr-on-init=\"@this@.onInitDetailsElement($element)\" dr-option-complete=\"@this@.test()\" dr-event-toggle=\"@this@.toggle($element, $event)\">\\n' +\n '\\n' +\n ' #innerHTML#\\n' +\n '</details>\\n' +\n '<select hidden=\"hidden\" name=\"${@this@.name}$\" disabled=\"${@this@.disabled ? \\'disabled\\' : null}$\" style=\"width: 1500px; height:500px\" multiple>\\n' +\n ' <option dr-for-of=\"@this@.options\" value=\"${#it#.value}$\" selected=\"${#it#.selected ? \\'selected\\' : null}$\">#it# ${#it#.value}$</option>\\n' +\n '</select',\n objFactory: (e, o, r2, constructorParam) => DomRender.run({ rootObject: new Select.Select(config), config })\n });\n },\n selectSummary: (config?: DomRenderRunConfig) => {\n return RawSet.createComponentTargetElement({\n name: `${Select.selector}-summary`,\n template:\n '<summary dr-class=\"{[@this@.classAttr]: @this@.classAttr}\"\\n' +\n ' dr-on-init=\"@this@.onInitSummaryElement($element, $event)\"\\n' +\n ' dr-event-click=\"@this@.onSummaryClick($element, $event)\"\\n' +\n '>\\n' +\n '#innerHTML#\\n' +\n '</summary>',\n objFactory: (e, o, r2, constructorParam) => DomRender.run({ rootObject: new Select.Summary(), config })\n });\n },\n selectSummaryPlaceholder: stateComponentFactory(`${Select.selector}-summary-placeholder`, Select.SummaryPlaceholder),\n selectSummarySelected: stateComponentFactory(`${Select.selector}-summary-selected`, Select.SummarySelected),\n selectSummaryDisabled: stateComponentFactory(`${Select.selector}-summary-disabled`, Select.SummaryDisabled),\n\n selectBody: (config?: DomRenderRunConfig) => { // New export\n return RawSet.createComponentTargetElement({\n name: `${Select.selector}-body`,\n template: '<div dr-class=\"{[@this@.classAttr]: @this@.classAttr, \\'dr-select-body-container\\': true, [\\'dr-select-body-\\'+@this@.float+\\'-container\\']: @this@.float}\">#innerHTML#</div>',\n objFactory: (e, o, r2, constructorParam) => {\n return DomRender.run({rootObject: new Select.SelectBody(), config: config});\n }\n })\n },\n\n selectOption: (config?: DomRenderRunConfig) => {\n return RawSet.createComponentTargetElement({\n name: `${Select.selector}-option`,\n template:\n '<a dr-class=\"{[@this@.classAttr]: @this@.classAttr}\" dr-event-click=\"@this@.toggleSelected($event)\">#innerHTML#</a>\\n',\n objFactory: (e, o, r2, constructorParam) => DomRender.run({ rootObject: new Select.Option(), config })\n });\n },\n selectOptionSelected: stateComponentFactory(`${Select.selector}-option-selected`, Select.OptionSelected),\n selectOptionUnselected: stateComponentFactory(`${Select.selector}-option-unselected`, Select.OptionUnselected),\n selectOptionDisabled: stateComponentFactory(`${Select.selector}-option-disabled`, Select.OptionDisabled),\n};"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;AAAA,2BAAsD;AACtD,uBAA8C;AAC9C,oBAAuB;AAIvB,wBAA2B;AAE3B,wBAA2B;AAC3B,8BAAiC;AAGjC,yBAA4B;;;;;;;;;;
|
|
4
|
+
"sourcesContent": ["import { attribute, ChildrenSet, ComponentBase } from '../ComponentBase';\nimport { DomRender, DomRenderRunConfig } from '../../DomRender';\nimport { RawSet } from '../../rawsets/RawSet';\nimport { OnCreateRenderData, OnCreateRenderDataParams } from '../../lifecycle/OnCreateRenderData';\nimport { OnInitRender } from '../../lifecycle/OnInitRender';\nimport { OnDestroyRender } from '../../lifecycle/OnDestroyRender';\nimport { EventUtils } from '@dooboostore/core-web/event/EventUtils';\nimport { type Subscription } from '@dooboostore/core/message/Subscription';\nimport { ValidUtils } from '@dooboostore/core-web/valid/ValidUtils';\nimport { DomRenderNoProxy } from '../../decorators/DomRenderNoProxy';\nimport { OnCreateRender } from '../../lifecycle/OnCreateRender';\nimport { DomRenderConfig } from '../../configs/DomRenderConfig';\nimport { WindowUtils } from '@dooboostore/core-web/window/WindowUtils';\nimport { OnRawSetRenderedOtherData } from 'src/lifecycle';\n\n/** 사용법\n <dr-select class=\"card-select-container\" changeSelected=\"${(data) => @this@.changeSelected(data)}$\"> <!-- multiple attribute optional-->\n <dr-select-summary class=\"card-select-summary-container\">\n <dr-select-summary-placeholder>\n <div class=\"card-select-summary-placeholder-container\">카드사별 사용처 안내 페이지 선택</div>\n </dr-select-summary-placeholder>\n <dr-select-summary-selected>\n <div dr-if=\"@this@.selectedCard\" class=\"card-select-summary-selected-container\">\n <img dr-attr=\"{src:@this@.selectedCard?.iconImg}\"> ${@this@.selectedCard?.name}$\n </div>\n </dr-select-summary-selected>\n </dr-select-summary>\n\n <dr-select-body float=\"bottom-left\" class=\"card-select-body-container\">\n <dr-select-option dr-for-of=\"@this@.cards\" value=\"${#it#.name}$\" selected=\"${#nearForOfIndex# === 0}$\" class=\"card-select-body-option-container\">\n <img dr-attr=\"{src:#it#.iconImg}\"> ${#it#.name}$\n </dr-select-option>\n </dr-select-body>\n </dr-select>\n */\n\nexport namespace Select {\n export const selector = 'dr-select';\n\n // Base for simple hide/show components\n class StateComponent extends ComponentBase {\n public hidden = true;\n public value: string | null = null;\n\n constructor(config: any) {\n super(config);\n }\n\n setValue(value: string | null) {\n this.value = value;\n }\n }\n\n // --- Option Child Components ---\n export class OptionSelected extends StateComponent {\n constructor() {\n super({onlyParentType: Option});\n }\n }\n\n export class OptionUnselected extends StateComponent {\n constructor() {\n super({onlyParentType: Option});\n }\n }\n\n export class OptionDisabled extends StateComponent {\n constructor() {\n super({onlyParentType: Option});\n }\n }\n\n // --- Summary Child Components ---\n export class SummaryPlaceholder extends StateComponent {\n constructor() {\n super({onlyParentType: Summary});\n }\n }\n\n export class SummarySelected extends StateComponent {\n private selectedOptions: Select.Option[] = [];\n\n constructor() {\n super({onlyParentType: Summary});\n }\n\n setOptions(options: Option[] = []) {\n this.selectedOptions = options.filter(it => it.selected);\n }\n }\n\n export class SummaryDisabled extends StateComponent {\n private selectedOptions: Select.Option[] = [];\n\n constructor() {\n super({onlyParentType: Summary});\n }\n\n setOptions(options: Option[] = []) {\n this.selectedOptions = options.filter(it => it.selected);\n }\n }\n\n // --- Select Body Component ---\n export type SelectBodyAttribute = {\n float?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';\n class?: string;\n }\n // --- Option Component ---\n export type OptionAttribute = { value: string; selected?: boolean | null; disabled?: boolean | null; class?: string; };\n\n export class Option extends ComponentBase<OptionAttribute> implements OnInitRender {\n public hidden = true;\n @attribute({name: 'value'}) public value: string | null = null;\n @attribute({name: 'selected', converter: v => v !== null && v === true}) public selected = false;\n @attribute({name: 'disabled', converter: v => v !== null && v === true}) public disabled = false;\n @attribute({name: 'class', converter: v => (v ? v : null)}) public classAttr: string | null = null;\n\n // public status: 'selected' | 'unselected' | 'disabled' = 'unselected';\n\n constructor() {\n super({onlyParentType: SelectBody});\n }\n\n onInitRender(param: any, rawSet: RawSet) {\n super.onInitRender(param, rawSet);\n // console.log('-----', this.value, this.selected)\n // this.getElement()?.addEventListener('click', (e) => {\n // e.stopPropagation();\n // if (!this.disabled) {\n // this.getParentThis<Select>().handleOptionClick(this);\n // }\n // });\n this.updateStatus();\n }\n\n // onCreatedThisChild(child: any, data: OnCreateRenderDataParams) {\n // super.onCreatedThisChild(child, data);\n // this.updateStatus();\n // }\n\n // async onRawSetRendered(rawSet:RawSet, otherData:OnRawSetRenderedOtherData):Promise<void>{\n // await super.onRawSetRendered(rawSet, otherData);\n // }\n onCreatedThisChildDebounce(childrenSet: ChildrenSet[]) {\n super.onCreatedThisChildDebounce(childrenSet);\n this.updateStatus();\n }\n\n toggleSelected(event: Event) {\n // console.log('isMultiple', this.isMultiple())\n if (!this.disabled) {\n this.selected = this.isMultiple()? !this.selected : true;\n // this.selected = !this.selected;\n this.updateStatus();\n this.getParentThis<SelectBody>().changeOptionState(this);\n } else {\n event.stopPropagation();\n event.preventDefault();\n }\n }\n\n isMultiple() {\n return this.getParentThis<Select.SelectBody>()?.getParentThis<Select.Select>().multiple;\n }\n\n updateStatus() {\n if (this.disabled) {\n this.getChildren(OptionSelected).forEach(c => {\n c.hidden = true;\n c.setValue(this.value)\n });\n this.getChildren(OptionUnselected).forEach(c => {\n c.hidden = true;\n c.setValue(this.value)\n });\n this.getChildren(OptionDisabled).forEach(c => {\n c.hidden = false;\n c.setValue(this.value)\n });\n return;\n }\n\n if (this.selected) {\n this.getChildren(OptionSelected).forEach(c => {\n c.hidden = false;\n c.setValue(this.value)\n });\n this.getChildren(OptionUnselected).forEach(c => {\n c.hidden = true;\n c.setValue(this.value)\n });\n this.getChildren(OptionDisabled).forEach(c => {\n c.hidden = true;\n c.setValue(this.value)\n });\n }\n\n if (!this.selected) {\n this.getChildren(OptionSelected).forEach(c => {\n c.hidden = true;\n c.setValue(this.value)\n });\n this.getChildren(OptionUnselected).forEach(c => {\n c.hidden = false;\n c.setValue(this.value)\n });\n this.getChildren(OptionDisabled).forEach(c => {\n c.hidden = true;\n c.setValue(this.value)\n });\n }\n }\n }\n\n // --- Summary Component ---\n export class Summary extends ComponentBase implements OnInitRender {\n @attribute({ name: 'class', converter: v => (v === '' ? null : v) }) public classAttr: string | null = null;\n private options: Select.Option[] = [];\n private disabled: boolean = false;\n public element?: HTMLElement;\n\n // constructor() {\n // super({ onlyParentType: Select });\n // }\n\n setDisabled(disabled: boolean) {\n this.disabled = disabled;\n this.getChildren(SummaryPlaceholder).forEach(it => (it.hidden = true));\n this.getChildren(SummarySelected).forEach(it => (it.hidden = true));\n this.getChildren(SummaryDisabled).forEach(it => (it.hidden = false));\n }\n\n setOptions(options: Option[] = []): void {\n this.options = options;\n\n const selectedOptions = this.options.filter(it => it.selected && !it.disabled);\n if (!this.disabled) {\n if (selectedOptions.length > 0) {\n this.getChildren(SummaryPlaceholder).forEach(it => (it.hidden = true));\n this.getChildren(SummarySelected).forEach(c => {\n c.setOptions(options);\n c.hidden = false;\n });\n this.getChildren(SummaryDisabled).forEach(it => (it.hidden = true));\n } else {\n this.getChildren(SummaryDisabled).forEach(it => (it.hidden = true));\n this.getChildren(SummaryPlaceholder).forEach(it => (it.hidden = false));\n this.getChildren(SummarySelected).forEach(c => (c.hidden = true));\n }\n }\n }\n\n onInitRender(param: any, rawSet: RawSet) {\n super.onInitRender(param, rawSet);\n // this.getElement()?.addEventListener('click', (e) => {\n // e.stopPropagation();\n // this.getParentThis<Select>().toggle();\n // });\n }\n\n onInitSummaryElement(element: HTMLElement, event: Event) {\n this.element = element;\n }\n\n updateView(hasSelection: boolean) {\n this.getChildren(SummaryPlaceholder).forEach(c => (c.hidden = hasSelection));\n this.getChildren(SummarySelected).forEach(c => (c.hidden = !hasSelection));\n }\n\n // onCreatedThisChild(child: any, data: OnCreateRenderDataParams) {\n // super.onCreatedThisChild(child, data);\n // }\n // async onRawSetRendered(rawSet: RawSet, otherData: OnRawSetRenderedOtherData): Promise<void> {\n // await super.onRawSetRendered(rawSet, otherData);\n // }\n onCreatedThisChildDebounce(childrenSet: ChildrenSet[]) {\n super.onCreatedThisChildDebounce(childrenSet);\n this.updateView(this.getParentThis<Select>()?.selectedValues?.length > 0);\n }\n\n onSummaryClick(element: HTMLElement, event: Event) {\n if (this.getParentThis<Select>()?.disabled) {\n event.stopPropagation();\n event.preventDefault();\n return;\n }\n }\n }\n\n\n export class SelectBody extends ComponentBase<SelectBodyAttribute> {\n @attribute({ name: 'class', converter: v => (v === '' ? null : v) }) public classAttr: string | null = null;\n @attribute({ name: 'float' }) public float: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right' | null = null;\n\n constructor() {\n super({ onlyParentType: Select });\n }\n\n async onRawSetRendered(rawSet: RawSet, otherData: OnRawSetRenderedOtherData): Promise<void> {\n await super.onRawSetRendered(rawSet, otherData);\n // }\n // onCreatedThisChildDebounce(childrenSet: ChildrenSet[]) {\n // super.onCreatedThisChildDebounce(childrenSet);\n this.changeOptionState();\n }\n\n changeOptionState(option?: Option) {\n const options = this.getChildren(Option);\n const select = this.getParentThis<Select>();\n // console.log('------opti',option, select);\n // // 멀티플이 아닐때에는 마지막 선택된값으로 처리\n if (!select.multiple) {\n // 내가 선택한게 있으면\n if (option && option.selected) {\n options.filter(it => it !== option).forEach(it => {\n it.selected = false;\n it.updateStatus();\n });\n } else {\n const selectedOptions = options.filter(it => it.selected && !it.disabled);\n selectedOptions.forEach((opt, idx) => {\n const isLast = idx === selectedOptions.length - 1;\n if (!isLast) {\n opt.selected = false;\n opt.updateStatus();\n }\n });\n }\n }\n // console.log('--------', options.map(it=>it.selected))\n select?.setOptions(options);\n }\n }\n\n\n // --- Main Select Component ---\n export type SelectAttribute = {\n multiple?: boolean | null; class?: string;\n changeSelected?: (value: (string | null)[]) => void;\n name?: string;\n float?: 'bottom-left' | 'bottom-right' | 'top-left' | 'top-right';\n disableOtherClickClose?: boolean;\n toggle?: (open: boolean) => void;\n disabled?: boolean | null;\n };\n\n export class Select extends ComponentBase<SelectAttribute> implements OnInitRender, OnCreateRender, OnCreateRenderData, OnDestroyRender {\n @attribute({name: 'multiple', converter: v => v !== null}) public multiple = false;\n @attribute({name: 'disabled', converter: v => v !== null}) public disabled = false;\n @attribute({name: 'class', converter: v => (v === '' ? null : v)}) public classAttr: string | null = null;\n @attribute({name: 'name', converter: v => (v === '' ? null : v)}) public name: string | null = null;\n\n // public isOpen = false;\n public selectedValues: (string | null)[] = [];\n public selectedOptions: Option[] = [];\n public value: string | (string | null)[] | null | undefined;\n\n @DomRenderNoProxy private element?: HTMLDetailsElement;\n @DomRenderNoProxy private documentClickSubscription?: Subscription;\n @DomRenderNoProxy private windowBlurSubscription?: Subscription;\n @DomRenderNoProxy public summaryComponent?: Summary;\n @DomRenderNoProxy public selectBodyComponent?: SelectBody;\n private options?: Select.Option[];\n\n constructor(config?: DomRenderConfig) {\n super();\n // console.log('----Select constructor')\n }\n\n get optionComponents(): Option[] {\n return this.getChildren(Option);\n }\n\n onCreateRender() {\n\n }\n\n onCreateRenderData() {\n\n }\n\n onInitRender(param: any, rawSet: RawSet) {\n super.onInitRender(param, rawSet);\n // console.log('select onInitRender', this.multiple)\n\n if (ValidUtils.isBrowser() && this.rawSet?.dataSet.config.window) {\n const detailsElement = this.element;\n\n const window = this.rawSet.dataSet!.config!.window!;\n const document = window.document;\n this.documentClickSubscription = EventUtils.htmlElementEventObservable(document, 'click').subscribe(event => {\n const isSummaryClick = this.getChildren(Summary).some(it => event.target && it.element?.contains(event.target as Node) || it.element === event.target)\n if (!isSummaryClick && this.getAttribute('disableOtherClickClose')) {\n return;\n }\n if (!isSummaryClick && !this.multiple && detailsElement) {\n detailsElement.open = false;\n return;\n }\n if (!isSummaryClick && detailsElement && !detailsElement?.contains(event?.target as Node)) {\n detailsElement.open = false;\n }\n })\n\n this.windowBlurSubscription = WindowUtils.eventObservable(window, 'blur').subscribe(() => {\n if (detailsElement?.open && window.document.activeElement?.tagName === 'IFRAME') {\n detailsElement.open = false;\n }\n });\n }\n }\n\n\n toggle(element: HTMLDetailsElement, event: Event) {\n // console.log('------>', this.disabled, event)\n // if (this.disabled) {\n // event.stopPropagation();\n // event.preventDefault();\n // return;\n // }\n const toggleAttribute = this.getAttribute('toggle');\n if (toggleAttribute) {\n toggleAttribute?.(element.open);\n }\n }\n\n setOptions(options: Option[]) {\n const summaries = this.getChildren(Summary);\n\n this.options = options;\n\n const values = this.options.filter(it => it.selected && !it.disabled).map(it => it.value)\n this.getAttribute('changeSelected')?.(values);\n summaries?.forEach(it => {\n it.setDisabled(this.disabled);\n if (!this.disabled) {\n it.setOptions(options);\n }\n })\n }\n\n onInitDetailsElement(detailsElement: HTMLDetailsElement) {\n // console.log('detailsElement oninit', detailsElement);\n this.element = detailsElement;\n }\n\n onDrThisUnBind() {\n super.onDrThisUnBind();\n this.onDestroyRender();\n }\n\n onDestroyRender() {\n super.onDestroyRender();\n this.documentClickSubscription?.unsubscribe();\n this.windowBlurSubscription?.unsubscribe();\n }\n\n test() {\n console.log('tttttttt')\n }\n }\n}\n\nconst stateComponentFactory = (name: string, type: any) => {\n return (config?: DomRenderRunConfig) =>\n RawSet.createComponentTargetElement({\n name,\n template: '<div dr-if=\"!@this@.hidden\" dr-option-strip=\"true\">#innerHTML#</div>\\n',\n objFactory: (e, o, r2, constructorParam) => DomRender.run({ rootObject: new type(), config })\n });\n};\n\nexport default {\n select: (config?: DomRenderConfig) => {\n return RawSet.createComponentTargetElement({\n name: Select.selector,\n styles:\n '.dr-select-container {\\n' +\n ' position: relative;\\n' +\n '\\n' +\n '}\\n' +\n '.dr-select-options-container {\\n' +\n ' display: none;\\n' +\n ' position: absolute;\\n' +\n ' top: 100%;\\n' +\n ' left: 0;\\n' +\n ' right: 0;\\n' +\n ' z-index: 10;\\n' +\n '}\\n' +\n '.dr-select-container.is-open .dr-select-options-container {\\n' +\n ' display: block;\\n' +\n '}\\n' +\n 'summary::-webkit-details-marker {\\n' +\n ' display: none;\\n' +\n '}\\n' +\n '/* Floating styles for dr-select-body */\\n' +\n '.dr-select-body-container {\\n' +\n ' position: absolute;\\n' +\n '}\\n' +\n '\\n' +\n '.dr-select-body-bottom-left-container {\\n' +\n ' position: absolute;\\n' +\n ' left: 0;\\n' +\n ' top: 100%;\\n' +\n '}\\n' +\n '\\n' +\n '.dr-select-body-bottom-right-container {\\n' +\n ' position: absolute;\\n' +\n ' right: 0;\\n' +\n ' top: 100%;\\n' +\n '}\\n' +\n '\\n' +\n '.dr-select-body-top-left-container {\\n' +\n ' position: absolute;\\n' +\n ' left: 0;\\n' +\n ' bottom: 100%;\\n' +\n '}\\n' +\n '\\n' +\n '.dr-select-body-top-right-container {\\n' +\n ' position: absolute;\\n' +\n ' right: 0;\\n' +\n ' bottom: 100%;\\n' +\n '}\\n' +\n '\\n' +\n '/* Reset default details/summary styles */\\n' +\n '.dr-select-container details {\\n' +\n ' display: block; /* Ensure it behaves like a block element */\\n' +\n '}\\n' +\n '\\n' +\n '.dr-select-container summary {\\n' +\n ' display: block; /* Ensure it behaves like a block element */\\n' +\n ' list-style: none; /* Remove default marker */\\n' +\n \" cursor: pointer; /* Indicate it's clickable */\\n\" +\n '}\\n' +\n '\\n' +\n '.dr-select-container summary::-webkit-details-marker,\\n' +\n '.dr-select-container summary::marker {\\n' +\n ' display: none; /* Hide marker for Webkit and standard */\\n' +\n '}',\n template:\n '<details dr-class=\"{\\n' +\n \" 'dr-select-container': true,\\n\" +\n \" 'is-open': @this@.isOpen,\\n\" +\n ' [@this@.classAttr]: @this@.classAttr\\n' +\n ' }\" dr-on-init=\"@this@.onInitDetailsElement($element)\" dr-option-complete=\"@this@.test()\" dr-event-toggle=\"@this@.toggle($element, $event)\">\\n' +\n '\\n' +\n ' #innerHTML#\\n' +\n '</details>\\n' +\n '<select hidden=\"hidden\" name=\"${@this@.name}$\" disabled=\"${@this@.disabled ? \\'disabled\\' : null}$\" style=\"width: 1500px; height:500px\" multiple>\\n' +\n ' <option dr-for-of=\"@this@.options\" value=\"${#it#.value}$\" selected=\"${#it#.selected ? \\'selected\\' : null}$\">#it# ${#it#.value}$</option>\\n' +\n '</select>',\n objFactory: (e, o, r2, constructorParam) => DomRender.run({ rootObject: new Select.Select(config), config })\n });\n },\n selectSummary: (config?: DomRenderRunConfig) => {\n return RawSet.createComponentTargetElement({\n name: `${Select.selector}-summary`,\n template:\n '<summary dr-class=\"{[@this@.classAttr]: @this@.classAttr}\"\\n' +\n ' dr-on-init=\"@this@.onInitSummaryElement($element, $event)\"\\n' +\n ' dr-event-click=\"@this@.onSummaryClick($element, $event)\"\\n' +\n '>\\n' +\n '#innerHTML#\\n' +\n '</summary>',\n objFactory: (e, o, r2, constructorParam) => DomRender.run({ rootObject: new Select.Summary(), config })\n });\n },\n selectSummaryPlaceholder: stateComponentFactory(`${Select.selector}-summary-placeholder`, Select.SummaryPlaceholder),\n selectSummarySelected: stateComponentFactory(`${Select.selector}-summary-selected`, Select.SummarySelected),\n selectSummaryDisabled: stateComponentFactory(`${Select.selector}-summary-disabled`, Select.SummaryDisabled),\n\n selectBody: (config?: DomRenderRunConfig) => { // New export\n return RawSet.createComponentTargetElement({\n name: `${Select.selector}-body`,\n template: '<div dr-class=\"{[@this@.classAttr]: @this@.classAttr, \\'dr-select-body-container\\': true, [\\'dr-select-body-\\'+@this@.float+\\'-container\\']: @this@.float}\">#innerHTML#</div>',\n objFactory: (e, o, r2, constructorParam) => {\n return DomRender.run({rootObject: new Select.SelectBody(), config: config});\n }\n })\n },\n\n selectOption: (config?: DomRenderRunConfig) => {\n return RawSet.createComponentTargetElement({\n name: `${Select.selector}-option`,\n template:\n '<a dr-class=\"{[@this@.classAttr]: @this@.classAttr}\" dr-event-click=\"@this@.toggleSelected($event)\">#innerHTML#</a>\\n',\n objFactory: (e, o, r2, constructorParam) => DomRender.run({ rootObject: new Select.Option(), config })\n });\n },\n selectOptionSelected: stateComponentFactory(`${Select.selector}-option-selected`, Select.OptionSelected),\n selectOptionUnselected: stateComponentFactory(`${Select.selector}-option-unselected`, Select.OptionUnselected),\n selectOptionDisabled: stateComponentFactory(`${Select.selector}-option-disabled`, Select.Option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
onInitRender(param, rawSet) {
|
|
32
32
|
super.onInitRender(param, rawSet);
|
|
33
|
-
|
|
33
|
+
this.getAttribute("onCreated")?.(this);
|
|
34
34
|
}
|
|
35
35
|
isRunning() {
|
|
36
|
-
return this.
|
|
36
|
+
return this.value !== void 0;
|
|
37
37
|
}
|
|
38
38
|
start() {
|
|
39
|
-
const
|
|
40
|
-
if (
|
|
41
|
-
this.
|
|
39
|
+
const timems = this.getAttribute("value");
|
|
40
|
+
if (timems) {
|
|
41
|
+
this.value = parseInt(timems);
|
|
42
|
+
const intervalValue = this.getAttribute("interval") ?? 1e3;
|
|
43
|
+
console.log("int", this.value, intervalValue);
|
|
42
44
|
this.interval = setInterval(() => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
+
console.log("--------->", this.value);
|
|
46
|
+
if (this.value) {
|
|
47
|
+
this.value--;
|
|
45
48
|
} else {
|
|
46
49
|
clearInterval(this.interval);
|
|
47
|
-
this.
|
|
50
|
+
this.value = void 0;
|
|
48
51
|
this.interval = void 0;
|
|
49
52
|
}
|
|
50
|
-
},
|
|
53
|
+
}, intervalValue);
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
stop() {
|
|
54
57
|
if (this.interval) {
|
|
55
58
|
clearInterval(this.interval);
|
|
56
59
|
this.interval = void 0;
|
|
57
|
-
this.
|
|
60
|
+
this.value = void 0;
|
|
58
61
|
}
|
|
59
62
|
}
|
|
60
63
|
onChangeAttrRender(name, val, other) {
|
|
@@ -71,7 +74,7 @@ var Timer;
|
|
|
71
74
|
_Timer.Timer = Timer2;
|
|
72
75
|
})(Timer || (Timer = {}));
|
|
73
76
|
var Timer_default = {
|
|
74
|
-
|
|
77
|
+
timer: (config) => {
|
|
75
78
|
return import_RawSet.RawSet.createComponentTargetElement({
|
|
76
79
|
name: `${Timer.selector}`,
|
|
77
80
|
template: "#innerHTML#",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/components/timer/Timer.ts"],
|
|
4
|
-
"sourcesContent": ["import { ComponentBase } from '../ComponentBase';\nimport { DomRender, DomRenderRunConfig } from '../../DomRender';\nimport { RawSet } from '../../rawsets/RawSet';\nimport { OtherData } from '../../lifecycle/OnChangeAttrRender';\nimport { OnDestroyRenderParams } from '../../lifecycle/OnDestroyRender';\n\n\nexport namespace Timer {\n export const selector = 'dr-timer';\n export type Attribute = {\n
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAA8B;AAC9B,uBAA8C;AAC9C,oBAAuB;AAKhB,IAAU;AAAA,CAAV,CAAU,WAAV;AACE,EAAM,kBAAW;AAAA,
|
|
4
|
+
"sourcesContent": ["import { ComponentBase } from '../ComponentBase';\nimport { DomRender, DomRenderRunConfig } from '../../DomRender';\nimport { RawSet } from '../../rawsets/RawSet';\nimport { OtherData } from '../../lifecycle/OnChangeAttrRender';\nimport { OnDestroyRenderParams } from '../../lifecycle/OnDestroyRender';\n\n\nexport namespace Timer {\n export const selector = 'dr-timer';\n export type Attribute = {\n value?: string;\n interval?: number;\n onCreated?: (timer: Timer) => void;\n }\n export class Timer extends ComponentBase<Attribute> {\n private interval?: any;\n private value?: number;\n\n\n onInitRender(param: any, rawSet: RawSet) {\n super.onInitRender(param, rawSet);\n this.getAttribute('onCreated')?.(this);\n // console.log('---2', this.getElement()?.isConnected)\n // const element = this.getElement();\n // if(element){\n // (element as any).component = this;\n // }\n }\n\n isRunning() {\n return this.value !== undefined;\n }\n\n start() {\n const timems = this.getAttribute('value');\n if (timems) {\n this.value = parseInt(timems);\n const intervalValue = this.getAttribute('interval') ?? 1000;\n console.log('int', this.value, intervalValue);\n this.interval = setInterval(() => {\n console.log('--------->',this.value)\n if (this.value) {\n this.value--;\n } else {\n clearInterval(this.interval);\n this.value = undefined;\n this.interval = undefined;\n }\n }, intervalValue)\n }\n }\n\n\n stop() {\n if (this.interval) {\n clearInterval(this.interval);\n this.interval = undefined;\n this.value = undefined;\n }\n }\n\n onChangeAttrRender(name: string, val: any, other: OtherData) {\n super.onChangeAttrRender(name, val, other);\n console.log('-----', name, val, this.getElement())\n }\n\n onDestroyRender(data: OnDestroyRenderParams) {\n super.onDestroyRender(data);\n if (this.interval){\n clearInterval(this.interval);\n }\n }\n }\n}\n\n\nexport default {\n timer: (config?: DomRenderRunConfig) => {\n return RawSet.createComponentTargetElement({\n name: `${Timer.selector}`,\n template: '#innerHTML#',\n objFactory: (e,o,r2, counstructorParam) => {\n return DomRender.run({rootObject: new Timer.Timer(...counstructorParam), config: config});\n }\n })\n },\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAA8B;AAC9B,uBAA8C;AAC9C,oBAAuB;AAKhB,IAAU;AAAA,CAAV,CAAU,WAAV;AACE,EAAM,kBAAW;AAAA,EAMjB,MAAMA,eAAc,mCAAyB;AAAA,IAKlD,aAAa,OAAY,QAAgB;AACvC,YAAM,aAAa,OAAO,MAAM;AAChC,WAAK,aAAa,WAAW,IAAI,IAAI;AAAA,IAMvC;AAAA,IAEA,YAAY;AACV,aAAO,KAAK,UAAU;AAAA,IACxB;AAAA,IAEA,QAAQ;AACN,YAAM,SAAS,KAAK,aAAa,OAAO;AACxC,UAAI,QAAQ;AACV,aAAK,QAAQ,SAAS,MAAM;AAC5B,cAAM,gBAAgB,KAAK,aAAa,UAAU,KAAK;AACvD,gBAAQ,IAAI,OAAO,KAAK,OAAO,aAAa;AAC5C,aAAK,WAAW,YAAY,MAAM;AAChC,kBAAQ,IAAI,cAAa,KAAK,KAAK;AACnC,cAAI,KAAK,OAAO;AACd,iBAAK;AAAA,UACP,OAAO;AACL,0BAAc,KAAK,QAAQ;AAC3B,iBAAK,QAAQ;AACb,iBAAK,WAAW;AAAA,UAClB;AAAA,QACF,GAAG,aAAa;AAAA,MAClB;AAAA,IACF;AAAA,IAGA,OAAO;AACL,UAAI,KAAK,UAAU;AACjB,sBAAc,KAAK,QAAQ;AAC3B,aAAK,WAAW;AAChB,aAAK,QAAQ;AAAA,MACf;AAAA,IACF;AAAA,IAEA,mBAAmB,MAAc,KAAU,OAAkB;AAC3D,YAAM,mBAAmB,MAAM,KAAK,KAAK;AACzC,cAAQ,IAAI,SAAS,MAAM,KAAK,KAAK,WAAW,CAAC;AAAA,IACnD;AAAA,IAEA,gBAAgB,MAA6B;AAC3C,YAAM,gBAAgB,IAAI;AAC1B,UAAI,KAAK,UAAS;AAChB,sBAAc,KAAK,QAAQ;AAAA,MAC7B;AAAA,IACF;AAAA,EACF;AA1DO,SAAM,QAAAA;AAAA,GAPE;AAqEjB,IAAO,gBAAQ;AAAA,EACb,OAAO,CAAC,WAAgC;AACtC,WAAO,qBAAO,6BAA6B;AAAA,MACzC,MAAM,GAAG,MAAM,QAAQ;AAAA,MACvB,UAAU;AAAA,MACV,YAAY,CAAC,GAAE,GAAE,IAAI,sBAAsB;AACzC,eAAO,2BAAU,IAAI,EAAC,YAAY,IAAI,MAAM,MAAM,GAAG,iBAAiB,GAAG,OAAc,CAAC;AAAA,MAC1F;AAAA,IACF,CAAC;AAAA,EACH;AACF;",
|
|
6
6
|
"names": ["Timer"]
|
|
7
7
|
}
|
|
@@ -23,6 +23,7 @@ __export(DomRenderNoProxy_exports, {
|
|
|
23
23
|
isDomRenderNoProxy: () => isDomRenderNoProxy
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(DomRenderNoProxy_exports);
|
|
26
|
+
var import_ValidUtils = require("@dooboostore/core/valid/ValidUtils");
|
|
26
27
|
const DomRenderNoProxyKey = "DomRender:NoProxy";
|
|
27
28
|
const DomRenderNoProxy = (target, propertyKey) => {
|
|
28
29
|
if (propertyKey === void 0) {
|
|
@@ -38,6 +39,6 @@ const getDomRenderNoProxy = (target, propertyKey) => {
|
|
|
38
39
|
return Reflect.getMetadata(DomRenderNoProxyKey, target, propertyKey);
|
|
39
40
|
};
|
|
40
41
|
const isDomRenderNoProxy = (target, propertyKey) => {
|
|
41
|
-
return getDomRenderNoProxy(target, propertyKey) === true;
|
|
42
|
+
return import_ValidUtils.ValidUtils.isNullOrUndefined(target) || getDomRenderNoProxy(target, propertyKey) === true;
|
|
42
43
|
};
|
|
43
44
|
//# sourceMappingURL=DomRenderNoProxy.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/decorators/DomRenderNoProxy.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
4
|
+
"sourcesContent": ["import { ValidUtils } from '@dooboostore/core/valid/ValidUtils';\n\nexport const DomRenderNoProxyKey = 'DomRender:NoProxy'\nexport const DomRenderNoProxy = (target: any, propertyKey?: string | symbol) => {\n // \uD074\uB798\uC2A4 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0\n if (propertyKey === undefined) {\n // target\uC740 \uD074\uB798\uC2A4 \uC0DD\uC131\uC790\n Reflect.defineMetadata(DomRenderNoProxyKey, true, target);\n return;\n }\n\n // \uD504\uB85C\uD37C\uD2F0 \uB370\uCF54\uB808\uC774\uD130\uB85C \uC0AC\uC6A9\uB41C \uACBD\uC6B0\n // target\uC740 \uD504\uB85C\uD1A0\uD0C0\uC785, propertyKey\uB294 \uD504\uB85C\uD37C\uD2F0 \uC774\uB984\n Reflect.defineMetadata(DomRenderNoProxyKey, true, target, propertyKey);\n};\n\nexport const getDomRenderNoProxy = (target: any, propertyKey?: string | symbol) => {\n // if (ValidUtils.isNotNullUndefined(target)) {\n // \uD074\uB798\uC2A4 \uB370\uCF54\uB808\uC774\uD130\n if (propertyKey === undefined) {\n return Reflect.getMetadata(DomRenderNoProxyKey, target);\n }\n // \uD504\uB85C\uD37C\uD2F0 \uB370\uCF54\uB808\uC774\uD130\n return Reflect.getMetadata(DomRenderNoProxyKey, target, propertyKey);\n // } else {\n // return undefined;\n // }\n}\n\nexport const isDomRenderNoProxy = (target: any, propertyKey?: string | symbol) => {\n return ValidUtils.isNullOrUndefined(target) || getDomRenderNoProxy(target, propertyKey) === true;\n}"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA2B;AAEpB,MAAM,sBAAsB;AAC5B,MAAM,mBAAmB,CAAC,QAAa,gBAAkC;AAE5E,MAAI,gBAAgB,QAAW;AAE7B,YAAQ,eAAe,qBAAqB,MAAM,MAAM;AACxD;AAAA,EACF;AAIA,UAAQ,eAAe,qBAAqB,MAAM,QAAQ,WAAW;AACzE;AAEO,MAAM,sBAAsB,CAAC,QAAa,gBAAkC;AAG/E,MAAI,gBAAgB,QAAW;AAC7B,WAAO,QAAQ,YAAY,qBAAqB,MAAM;AAAA,EACxD;AAEA,SAAO,QAAQ,YAAY,qBAAqB,QAAQ,WAAW;AAIvE;AAEO,MAAM,qBAAqB,CAAC,QAAa,gBAAkC;AAChF,SAAO,6BAAW,kBAAkB,MAAM,KAAK,oBAAoB,QAAQ,WAAW,MAAM;AAC9F;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var OnRawSetRendered_exports = {};
|
|
19
|
+
__export(OnRawSetRendered_exports, {
|
|
20
|
+
isOnRawSetRendered: () => isOnRawSetRendered
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(OnRawSetRendered_exports);
|
|
23
|
+
const isOnRawSetRendered = (obj) => {
|
|
24
|
+
return typeof obj?.onRawSetRendered === "function";
|
|
25
|
+
};
|
|
26
|
+
//# sourceMappingURL=OnRawSetRendered.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/lifecycle/OnRawSetRendered.ts"],
|
|
4
|
+
"sourcesContent": ["import { RawSet, RenderResult } from '../rawsets/RawSet';\n\nexport type OnRawSetRenderedOtherData = {\n path?: string\n renderResult?: RenderResult\n // rawSet?: RawSet\n}\nexport interface OnRawSetRendered {\n// TODO: \uD638\uCD9C\uB41C\uACF3\uC5D0\uC11C \uB610 \uBCC0\uC218\uB97C \uC218\uC815\uD558\uAC8C\uB418\uBA74 \uBB34\uD55C\uB8E8\uD504\uB2C8\uAE50 \uC660\uB9CC\uD558\uBA74 \uC0AC\uC6A9\uBABB\uD558\uAC8C \uD574\uC57C\uD55C\uB2E4.\n onRawSetRendered (rawSet: RawSet,otherData: OnRawSetRenderedOtherData): Promise<void>;\n}\n\nexport const isOnRawSetRendered= (obj: any): obj is OnRawSetRendered => {\n return typeof obj?.onRawSetRendered === 'function';\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYO,MAAM,qBAAoB,CAAC,QAAsC;AACpE,SAAO,OAAO,KAAK,qBAAqB;AAC5C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -25,5 +25,6 @@ __reExport(lifecycle_exports, require("./OnCreatedThisChild"), module.exports);
|
|
|
25
25
|
__reExport(lifecycle_exports, require("./OnDestroyRender"), module.exports);
|
|
26
26
|
__reExport(lifecycle_exports, require("./OnInitRender"), module.exports);
|
|
27
27
|
__reExport(lifecycle_exports, require("./OnProxyDomRender"), module.exports);
|
|
28
|
+
__reExport(lifecycle_exports, require("./OnRawSetRendered"), module.exports);
|
|
28
29
|
__reExport(lifecycle_exports, require("./dr-this"), module.exports);
|
|
29
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/lifecycle/index.ts"],
|
|
4
|
-
"sourcesContent": ["export * from './OnBeforeReturnGet';\nexport * from './OnBeforeReturnSet';\nexport * from './OnChangeAttrRender';\nexport * from './OnChildRenderedByProperty';\nexport * from './OnCreateRender';\nexport * from './OnCreateRenderData';\nexport * from './OnCreateRendered';\nexport * from './OnCreatedThisChild';\nexport * from './OnDestroyRender';\nexport * from './OnInitRender';\nexport * from './OnProxyDomRender';\nexport * from './dr-this';\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,8BAAc,gCAAd;AACA,8BAAc,gCADd;AAEA,8BAAc,iCAFd;AAGA,8BAAc,wCAHd;AAIA,8BAAc,6BAJd;AAKA,8BAAc,iCALd;AAMA,8BAAc,+BANd;AAOA,8BAAc,iCAPd;AAQA,8BAAc,8BARd;AASA,8BAAc,2BATd;AAUA,8BAAc,+BAVd;AAWA,8BAAc,
|
|
4
|
+
"sourcesContent": ["export * from './OnBeforeReturnGet';\nexport * from './OnBeforeReturnSet';\nexport * from './OnChangeAttrRender';\nexport * from './OnChildRenderedByProperty';\nexport * from './OnCreateRender';\nexport * from './OnCreateRenderData';\nexport * from './OnCreateRendered';\nexport * from './OnCreatedThisChild';\nexport * from './OnDestroyRender';\nexport * from './OnInitRender';\nexport * from './OnProxyDomRender';\nexport * from './OnRawSetRendered';\nexport * from './dr-this';\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA,8BAAc,gCAAd;AACA,8BAAc,gCADd;AAEA,8BAAc,iCAFd;AAGA,8BAAc,wCAHd;AAIA,8BAAc,6BAJd;AAKA,8BAAc,iCALd;AAMA,8BAAc,+BANd;AAOA,8BAAc,iCAPd;AAQA,8BAAc,8BARd;AASA,8BAAc,2BATd;AAUA,8BAAc,+BAVd;AAWA,8BAAc,+BAXd;AAYA,8BAAc,sBAZd;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -69,6 +69,8 @@ class DrTargetElement extends import_OperatorExecuter.OperatorExecuter {
|
|
|
69
69
|
targetFragment = fragment;
|
|
70
70
|
}
|
|
71
71
|
const rr = import_RawSet.RawSet.checkPointCreates(targetFragment, this.source.obj, this.source.config);
|
|
72
|
+
rr.forEach((it, index) => {
|
|
73
|
+
});
|
|
72
74
|
if (targetElement.noStrip) {
|
|
73
75
|
Array.from(targetFragment.childNodes || []).forEach((child) => {
|
|
74
76
|
documentFragment.firstElementChild?.appendChild(child);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/operators/DrTargetElement.ts"],
|
|
4
|
-
"sourcesContent": ["import { ScriptUtils } from '@dooboostore/core-web/script/ScriptUtils';\nimport { RawSet } from '../rawsets/RawSet';\nimport { CreatorMetaData } from '../rawsets/CreatorMetaData';\nimport {\n AfterCallBack,\n ElementSource,\n ExecuteState,\n OperatorExecuter,\n ReturnContainer,\n Source\n} from './OperatorExecuter';\nimport { Render } from '../rawsets/Render';\n\ndeclare global {\n interface Window {\n HTMLMetaElement: typeof HTMLMetaElement;\n }\n}\n\n// \uC5EC\uAE30\uC11C \uC0AC\uC6A9\uC790\uAC00 \uB4F1\uB85D\uD55C TargetElement\uAC00 \uB4E4\uC5B4\uAC04\uB2E4.\nexport class DrTargetElement extends OperatorExecuter<void> {\n constructor(\n rawSet: RawSet,\n render: Render,\n returnContainer: ReturnContainer,\n elementSource: ElementSource,\n source: Source,\n afterCallBack: AfterCallBack\n ) {\n source.operatorAround = undefined;\n super(rawSet, render, returnContainer, elementSource, source, afterCallBack, false);\n }\n\n async execute(): Promise<ExecuteState> {\n const targetElement = this.source.config?.targetElements?.find(\n it => it.name.toLowerCase() === this.elementSource.element.tagName.toLowerCase()\n );\n if (targetElement) {\n if (\n this.rawSet.point.start instanceof this.source.config.window.HTMLMetaElement &&\n this.rawSet.point.end instanceof this.source.config.window.HTMLMetaElement\n ) {\n this.rawSet.point.start.setAttribute('this-path', `this.__domrender_components.${this.rawSet.uuid}`);\n this.rawSet.point.end.setAttribute('this-path', `this.__domrender_components.${this.rawSet.uuid}`);\n }\n\n const documentFragment = await targetElement.callBack(\n this.elementSource.element,\n this.source.obj,\n this.rawSet,\n this.elementSource.attrs,\n this.source.config\n );\n if (documentFragment) {\n const detectAction = this.elementSource.element.getAttribute(RawSet.DR_DETECT_NAME);\n // const dictionaryKey = this.elementSource.element.getAttribute(RawSet.DR_DICTIONARY_OPTIONKEYNAME);\n // console.log('dictionaryKey', dictionaryKey);\n // const render = (documentFragment as any).render;\n this.rawSet.dataSet.fragment = documentFragment;\n // if (documentFragment) {\n // const tempDiv = this.source.config.window.document.createElement('div');\n // tempDiv.appendChild(documentFragment.cloneNode(true));\n // console.log('DocumentFragment innerHTML:', tempDiv.innerHTML);\n // }\n\n // this.rawSet.dataSet??={};\n // this.rawSet.dataSet.data = render.component;\n if (detectAction && this.rawSet.dataSet.render) {\n // TODO: \uC5C6\uC5B4\uC838\uC57C\uB420\uB4EF?\n this.rawSet.detect = {\n action: () => {\n const script = `var $component = this.__render.component; var $element = this.__render.element; var $innerHTML = this.__render.innerHTML; var $attribute = this.__render.attribute; ${detectAction} `;\n ScriptUtils.evaluate(\n script,\n Object.assign(this.source.obj, {\n __render: this.rawSet.dataSet.render\n })\n );\n }\n };\n }\n // fag.append(documentFragment)\n\n // console.log('----------1', ElementUtils.toInnerHTML(documentFragment, {document: this.source.config.window.document}));\n // await Promises.sleep(1000)\n let targetFragment = documentFragment;\n if (targetElement.noStrip) {\n // documentFragment.firstElementChild.classList.add(`${this.rawSet.uuid}___DrTargetElement`)\n const fragment = this.source.config.window.document.createDocumentFragment();\n Array.from(documentFragment.firstElementChild?.childNodes || []).forEach(child => {\n // fragment.appendChild(child.cloneNode(true));\n fragment.appendChild(child);\n });\n // fragment.append(documentFragment.firstElementChild);\n targetFragment = fragment;\n }\n // console.log('----------2', ElementUtils.toInnerHTML(targetFragment, {document: this.source.config.window.document}));\n const rr = RawSet.checkPointCreates(targetFragment, this.source.obj, this.source.config);\n if (targetElement.noStrip) {\n Array.from(targetFragment.childNodes || []).forEach(child => {\n documentFragment.firstElementChild?.appendChild(child);\n });\n }\n this.elementSource.element.parentNode?.replaceChild(documentFragment, this.elementSource.element);\n this.returnContainer.raws.push(...rr);\n this.afterCallBack.onElementInitCallBacks.push({\n name: targetElement.name.toLowerCase(),\n obj: this.source.obj,\n targetElement,\n creatorMetaData: targetElement.__creatorMetaData as CreatorMetaData\n });\n // console.log('sssssssssssssss', this.source.obj);\n targetElement?.complete?.(this.elementSource.element, this.source.obj, this.rawSet);\n }\n return ExecuteState.EXECUTE;\n }\n return ExecuteState.NO_EXECUTE;\n }\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA4B;AAC5B,oBAAuB;AAEvB,8BAOO;
|
|
4
|
+
"sourcesContent": ["import { ScriptUtils } from '@dooboostore/core-web/script/ScriptUtils';\nimport { RawSet } from '../rawsets/RawSet';\nimport { CreatorMetaData } from '../rawsets/CreatorMetaData';\nimport {\n AfterCallBack,\n ElementSource,\n ExecuteState,\n OperatorExecuter,\n ReturnContainer,\n Source\n} from './OperatorExecuter';\nimport { Render } from '../rawsets/Render';\nimport { ElementUtils } from '@dooboostore/core-web/element/ElementUtils';\n\ndeclare global {\n interface Window {\n HTMLMetaElement: typeof HTMLMetaElement;\n }\n}\n\n// \uC5EC\uAE30\uC11C \uC0AC\uC6A9\uC790\uAC00 \uB4F1\uB85D\uD55C TargetElement\uAC00 \uB4E4\uC5B4\uAC04\uB2E4.\nexport class DrTargetElement extends OperatorExecuter<void> {\n constructor(\n rawSet: RawSet,\n render: Render,\n returnContainer: ReturnContainer,\n elementSource: ElementSource,\n source: Source,\n afterCallBack: AfterCallBack\n ) {\n source.operatorAround = undefined;\n super(rawSet, render, returnContainer, elementSource, source, afterCallBack, false);\n }\n\n async execute(): Promise<ExecuteState> {\n const targetElement = this.source.config?.targetElements?.find(\n it => it.name.toLowerCase() === this.elementSource.element.tagName.toLowerCase()\n );\n if (targetElement) {\n if (\n this.rawSet.point.start instanceof this.source.config.window.HTMLMetaElement &&\n this.rawSet.point.end instanceof this.source.config.window.HTMLMetaElement\n ) {\n this.rawSet.point.start.setAttribute('this-path', `this.__domrender_components.${this.rawSet.uuid}`);\n this.rawSet.point.end.setAttribute('this-path', `this.__domrender_components.${this.rawSet.uuid}`);\n }\n\n const documentFragment = await targetElement.callBack(\n this.elementSource.element,\n this.source.obj,\n this.rawSet,\n this.elementSource.attrs,\n this.source.config\n );\n if (documentFragment) {\n const detectAction = this.elementSource.element.getAttribute(RawSet.DR_DETECT_NAME);\n // const dictionaryKey = this.elementSource.element.getAttribute(RawSet.DR_DICTIONARY_OPTIONKEYNAME);\n // console.log('dictionaryKey', dictionaryKey);\n // const render = (documentFragment as any).render;\n this.rawSet.dataSet.fragment = documentFragment;\n // if (documentFragment) {\n // const tempDiv = this.source.config.window.document.createElement('div');\n // tempDiv.appendChild(documentFragment.cloneNode(true));\n // console.log('DocumentFragment innerHTML:', tempDiv.innerHTML);\n // }\n\n // this.rawSet.dataSet??={};\n // this.rawSet.dataSet.data = render.component;\n if (detectAction && this.rawSet.dataSet.render) {\n // TODO: \uC5C6\uC5B4\uC838\uC57C\uB420\uB4EF?\n this.rawSet.detect = {\n action: () => {\n const script = `var $component = this.__render.component; var $element = this.__render.element; var $innerHTML = this.__render.innerHTML; var $attribute = this.__render.attribute; ${detectAction} `;\n ScriptUtils.evaluate(\n script,\n Object.assign(this.source.obj, {\n __render: this.rawSet.dataSet.render\n })\n );\n }\n };\n }\n // fag.append(documentFragment)\n\n // console.log('----------1', ElementUtils.toInnerHTML(documentFragment, {document: this.source.config.window.document}));\n // await Promises.sleep(1000)\n let targetFragment = documentFragment;\n if (targetElement.noStrip) {\n // documentFragment.firstElementChild.classList.add(`${this.rawSet.uuid}___DrTargetElement`)\n const fragment = this.source.config.window.document.createDocumentFragment();\n Array.from(documentFragment.firstElementChild?.childNodes || []).forEach(child => {\n // fragment.appendChild(child.cloneNode(true));\n fragment.appendChild(child);\n });\n // fragment.append(documentFragment.firstElementChild);\n targetFragment = fragment;\n }\n // console.log('----------2', ElementUtils.toInnerHTML(targetFragment, {document: this.source.config.window.document}));\n const rr = RawSet.checkPointCreates(targetFragment, this.source.obj, this.source.config);\n rr.forEach((it, index) => {\n\n // const z = ElementUtils.toInnerHTML(it.dataSet.fragment, {document: this.source.config.window.document});\n // console.log('-z--z('+index+')', z, it);\n // it.point.start;\n // // \uC0C8\uB85C\uC6B4 comment element \uCD94\uAC00\n // const comment = this.source.config.window.document.createComment('\uC0C8\uB85C \uB9CC\uB4E0 comment element');\n // it.point.start.parentNode?.insertBefore(comment, it.point.start.nextSibling);\n })\n // for (let rawSet of rr) {\n // await rawSet.render(this.source.obj, this.source.config)\n // }\n // console.log('cccccccccccccccccccccc', rr, typeof Window);\n if (targetElement.noStrip) {\n Array.from(targetFragment.childNodes || []).forEach(child => {\n documentFragment.firstElementChild?.appendChild(child);\n });\n }\n this.elementSource.element.parentNode?.replaceChild(documentFragment, this.elementSource.element);\n this.returnContainer.raws.push(...rr);\n this.afterCallBack.onElementInitCallBacks.push({\n name: targetElement.name.toLowerCase(),\n obj: this.source.obj,\n targetElement,\n creatorMetaData: targetElement.__creatorMetaData as CreatorMetaData\n });\n // console.log('sssssssssssssss', this.source.obj);\n targetElement?.complete?.(this.elementSource.element, this.source.obj, this.rawSet);\n }\n return ExecuteState.EXECUTE;\n }\n return ExecuteState.NO_EXECUTE;\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA4B;AAC5B,oBAAuB;AAEvB,8BAOO;AAWA,MAAM,wBAAwB,yCAAuB;AAAA,EAC1D,YACE,QACA,QACA,iBACA,eACA,QACA,eACA;AACA,WAAO,iBAAiB;AACxB,UAAM,QAAQ,QAAQ,iBAAiB,eAAe,QAAQ,eAAe,KAAK;AAAA,EACpF;AAAA,EAEA,MAAM,UAAiC;AACrC,UAAM,gBAAgB,KAAK,OAAO,QAAQ,gBAAgB;AAAA,MACxD,QAAM,GAAG,KAAK,YAAY,MAAM,KAAK,cAAc,QAAQ,QAAQ,YAAY;AAAA,IACjF;AACA,QAAI,eAAe;AACjB,UACE,KAAK,OAAO,MAAM,iBAAiB,KAAK,OAAO,OAAO,OAAO,mBAC7D,KAAK,OAAO,MAAM,eAAe,KAAK,OAAO,OAAO,OAAO,iBAC3D;AACA,aAAK,OAAO,MAAM,MAAM,aAAa,aAAa,+BAA+B,KAAK,OAAO,IAAI,EAAE;AACnG,aAAK,OAAO,MAAM,IAAI,aAAa,aAAa,+BAA+B,KAAK,OAAO,IAAI,EAAE;AAAA,MACnG;AAEA,YAAM,mBAAmB,MAAM,cAAc;AAAA,QAC3C,KAAK,cAAc;AAAA,QACnB,KAAK,OAAO;AAAA,QACZ,KAAK;AAAA,QACL,KAAK,cAAc;AAAA,QACnB,KAAK,OAAO;AAAA,MACd;AACA,UAAI,kBAAkB;AACpB,cAAM,eAAe,KAAK,cAAc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,MACpF;AACA,aAAO,qCAAa;AAAA,IACtB;AACA,WAAO,qCAAa;AAAA,EACtB;AACF;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -21,7 +21,6 @@ __export(OperatorExecuter_exports, {
|
|
|
21
21
|
OperatorExecuter: () => OperatorExecuter
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(OperatorExecuter_exports);
|
|
24
|
-
var import_ScriptUtils = require("@dooboostore/core-web/script/ScriptUtils");
|
|
25
24
|
var import_ObjectUtils = require("@dooboostore/core/object/ObjectUtils");
|
|
26
25
|
var ExecuteState = /* @__PURE__ */ ((ExecuteState2) => {
|
|
27
26
|
ExecuteState2[ExecuteState2["EXECUTE"] = 0] = "EXECUTE";
|
|
@@ -47,7 +46,7 @@ class OperatorExecuter {
|
|
|
47
46
|
let r = attrValue;
|
|
48
47
|
if (r && this.startingExecute) {
|
|
49
48
|
const optionalPath = import_ObjectUtils.ObjectUtils.Path.toOptionalChainPath(attrValue);
|
|
50
|
-
r =
|
|
49
|
+
r = import_ObjectUtils.ObjectUtils.Script.evaluate(` ${this.render.bindScript}; return ${optionalPath}`, Object.assign(this.source.obj, { __render: this.render }));
|
|
51
50
|
}
|
|
52
51
|
if (this.source.operatorAround?.before) {
|
|
53
52
|
r = this.source.operatorAround?.before(r, this);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/operators/OperatorExecuter.ts"],
|
|
4
|
-
"sourcesContent": ["import { AttrInitCallBack } from '../rawsets/AttrInitCallBack';\nimport { ElementInitCallBack } from '../rawsets/ElementInitCallBack';\nimport { ComponentSet } from '../components/ComponentSet';\nimport { RawSet } from '../rawsets/RawSet';\nimport { Render } from '../rawsets/Render';\nimport { Attrs } from '../rawsets/Attrs';\nimport { DomRenderConfig } from '../configs/DomRenderConfig';\nimport {
|
|
5
|
-
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,yBAA4B;
|
|
4
|
+
"sourcesContent": ["import { AttrInitCallBack } from '../rawsets/AttrInitCallBack';\nimport { ElementInitCallBack } from '../rawsets/ElementInitCallBack';\nimport { ComponentSet } from '../components/ComponentSet';\nimport { RawSet } from '../rawsets/RawSet';\nimport { Render } from '../rawsets/Render';\nimport { Attrs } from '../rawsets/Attrs';\nimport { DomRenderConfig } from '../configs/DomRenderConfig';\nimport { ObjectUtils } from '@dooboostore/core/object/ObjectUtils';\n\nexport interface OperatorAround {\n beforeAttr?: (value: string | null | undefined, opratorExecutor: OperatorExecuter) => string | null | undefined,\n before?: (data: any, opratorExecutor: OperatorExecuter) => any,\n after?: (data: any, opratorExecutor: OperatorExecuter) => void,\n}\n\nexport enum ExecuteState {\n EXECUTE,\n NO_EXECUTE,\n STOP\n}\n\nexport type AfterCallBack = {\n onAttrInitCallBacks: AttrInitCallBack[],\n onElementInitCallBacks: ElementInitCallBack[],\n onThisComponentSetCallBacks: ComponentSet[]\n}\nexport type ReturnContainer = { raws: RawSet[], fag: DocumentFragment };\n\nexport type ElementSource = { element: Element, attrs: Attrs, attr?: string | null, attrName?: string | undefined };\n\nexport type Source = { config: DomRenderConfig, operatorAround?: OperatorAround, obj: any };\n\nexport abstract class OperatorExecuter<T = any> {\n constructor(public rawSet: RawSet,\n public render: Render,\n public returnContainer: ReturnContainer,\n public elementSource: ElementSource,\n public source: Source,\n public afterCallBack: AfterCallBack,\n public startingExecute = true) {\n };\n\n async start(): Promise<ExecuteState> {\n let attrValue = this.elementSource.attr;\n // console.log('OperatorExecuter ', attrValue, this);\n if (this.source.operatorAround?.beforeAttr) {\n attrValue = this.source.operatorAround.beforeAttr(attrValue, this) ?? '';\n }\n\n let r = attrValue;\n if (r && this.startingExecute) {\n const optionalPath = ObjectUtils.Path.toOptionalChainPath(attrValue);\n r = ObjectUtils.Script.evaluate(` ${this.render.bindScript}; return ${optionalPath}`, Object.assign(this.source.obj, {__render: this.render}));\n }\n if (this.source.operatorAround?.before) {\n r = this.source.operatorAround?.before(r, this);\n }\n\n const state = await this.execute(r as unknown as T)\n\n this.source.operatorAround?.after?.(r, this);\n return state;\n };\n\n abstract execute(value: T): Promise<ExecuteState>;\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,yBAA4B;AAQrB,IAAK,eAAL,kBAAKA,kBAAL;AACL,EAAAA,4BAAA;AACA,EAAAA,4BAAA;AACA,EAAAA,4BAAA;AAHU,SAAAA;AAAA,GAAA;AAiBL,MAAe,iBAA0B;AAAA,EAC9C,YAAmB,QACA,QACA,iBACA,eACA,QACA,eACA,kBAAkB,MAAM;AANxB;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,EACnB;AAAA,EAEA,MAAM,QAA+B;AACnC,QAAI,YAAY,KAAK,cAAc;AAEnC,QAAI,KAAK,OAAO,gBAAgB,YAAY;AAC1C,kBAAY,KAAK,OAAO,eAAe,WAAW,WAAW,IAAI,KAAK;AAAA,IACxE;AAEA,QAAI,IAAI;AACR,QAAI,KAAK,KAAK,iBAAiB;AAC7B,YAAM,eAAe,+BAAY,KAAK,oBAAoB,SAAS;AACnE,UAAI,+BAAY,OAAO,SAAS,IAAI,KAAK,OAAO,UAAU,YAAY,YAAY,IAAI,OAAO,OAAO,KAAK,OAAO,KAAK,EAAC,UAAU,KAAK,OAAM,CAAC,CAAC;AAAA,IAC/I;AACA,QAAI,KAAK,OAAO,gBAAgB,QAAQ;AACtC,UAAI,KAAK,OAAO,gBAAgB,OAAO,GAAG,IAAI;AAAA,IAChD;AAEA,UAAM,QAAQ,MAAM,KAAK,QAAQ,CAAiB;AAElD,SAAK,OAAO,gBAAgB,QAAQ,GAAG,IAAI;AAC3C,WAAO;AAAA,EACT;AAGF;",
|
|
6
6
|
"names": ["ExecuteState"]
|
|
7
7
|
}
|