admins-components 9.0.82 → 9.0.83
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/admins-components173.js +151 -89
- package/dist/admins-components173.js.map +1 -1
- package/dist/admins-components38.js +1 -1
- package/dist/admins-components38.js.map +1 -1
- package/dist/admins-components40.js.map +1 -1
- package/dist/admins-components68.js +12 -9
- package/dist/admins-components68.js.map +1 -1
- package/dist/admins-components70.js.map +1 -1
- package/dist/src/components/Modal.vue.d.ts +2 -0
- package/dist/test.html +163 -0
- package/dist/test81.html +161 -0
- package/dist/vueformelements/ArticlePickerElement.vue_vue_type_style_index_0_scoped_0afb93e7_lang.css +1 -0
- package/dist/widget/dist/search-posts-widget.css +1 -1
- package/dist/widget/dist/search-posts-widget.es.js +5608 -5601
- package/dist/widget/dist/search-posts-widget.umd.js +13 -13
- package/package.json +1 -1
- package/dist/vueformelements/ArticlePickerElement.vue_vue_type_style_index_0_scoped_54217a66_lang.css +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"admins-components70.js","names":[],"sources":["../src/components/data-table/DataTable.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type {\n LayoutMode,\n DataListConfig,\n DataListSettings,\n DataTableSettings,\n DataCardsSettings,\n Column,\n Sort,\n Action,\n ActionGroup,\n FilterConfig,\n FilterValue,\n} from '@/types/data-list'\n\nexport {\n dataTableSettingsDefaults,\n dataCardsSettingsDefaults,\n dataListSettingsDefaults,\n} from '@/types/data-list'\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, ref, onMounted, watch, nextTick } from 'vue'\nimport Checkbox from '@/components/Checkbox.vue'\nimport { useSelection } from '@/composables/useSelection'\nimport { dataTableSettingsDefaults } from '@/types/data-list'\nimport type { Column, DataListConfig, DataTableSettings, Sort } from '@/types/data-list'\nimport Loader from '@/components/Loader.vue'\nimport DataCell from './DataCell.vue'\nimport DataListActions from './DataListActions.vue'\n\ntype SortDirection = 'asc' | 'desc'\n\nconst props = withDefaults(\n defineProps<{\n config: DataListConfig\n items: Record<string, unknown>[]\n settings?: DataTableSettings\n loading?: boolean\n initialSort?: { key: string; direction: SortDirection } | null\n }>(),\n {\n settings: () => ({ ...dataTableSettingsDefaults }),\n loading: false,\n initialSort: null,\n },\n)\n\nconst emit = defineEmits<{\n 'selection-change': [selected: unknown[]]\n 'sort-change': [sort: { key: string; direction: SortDirection }]\n}>()\n\n//const CHARACTER_BREAKPOINT = 20\n\nconst activeSort = ref<{\n key: string\n direction: SortDirection\n} | null>(null)\n\nconst tableWrapperRef = ref<HTMLElement | null>(null)\n\nwatch(\n () => props.loading,\n async (isLoading) => {\n if (isLoading) {\n await nextTick()\n tableWrapperRef.value?.scrollTo({ top: 0, behavior: 'smooth' })\n }\n },\n)\n\nconst {\n selectedKeys,\n allSelected,\n toggle: toggleRow,\n toggleAll,\n} = useSelection(\n () => props.items,\n () => props.config.selectableAttr,\n (s) => emit('selection-change', s),\n)\n\nconst visibleColumns = computed(() => props.config.columns.filter((c) => c.visible !== false))\n\nfunction getSortConfig(col: Column): Sort | null {\n if (!col.sort) return null\n return typeof col.sort === 'boolean' ? null : col.sort\n}\n\nfunction isSortable(col: Column): boolean {\n return !!col.sort\n}\n\nfunction handleSort(col: Column) {\n const key = col.property\n const direction: SortDirection =\n activeSort.value?.key === key && activeSort.value.direction === 'asc' ? 'desc' : 'asc'\n\n activeSort.value = { key, direction }\n getSortConfig(col)?.callback?.(key, direction)\n\n emit('sort-change', { key, direction })\n}\n\nfunction applyInitialSort(sort: { key: string; direction: SortDirection } | null | undefined) {\n if (!sort) {\n if (activeSort.value !== null) activeSort.value = null\n return\n }\n const col = props.config.columns.find((c) => c.property === sort.key)\n if (!col) return\n if (activeSort.value?.key === sort.key && activeSort.value.direction === sort.direction) return\n activeSort.value = { key: sort.key, direction: sort.direction }\n getSortConfig(col)?.callback?.(sort.key, sort.direction)\n emit('sort-change', { key: sort.key, direction: sort.direction })\n}\n\nonMounted(() => applyInitialSort(props.initialSort))\nwatch(\n () => props.initialSort,\n (s) => {\n if (!s) {\n if (activeSort.value !== null) activeSort.value = null\n return\n }\n const col = props.config.columns.find((c) => c.property === s.key)\n if (!col) return\n if (activeSort.value?.key === s.key && activeSort.value.direction === s.direction) return\n activeSort.value = { key: s.key, direction: s.direction }\n },\n)\n</script>\n\n<template>\n <div\n ref=\"tableWrapperRef\"\n class=\"ac-component c-table-wrapper list-table-view\"\n :class=\"{ 'is-loading': loading }\"\n >\n <!-- :style=\"{ '--action-count': config.actions?.length ?? 0 }\" -->\n <table class=\"c-table\" :class=\"{ 'is-compact': settings.compact }\">\n <thead>\n <tr>\n <th v-if=\"config.selectableAttr\">\n <Checkbox :model-value=\"allSelected\" @update:model-value=\"toggleAll\" />\n </th>\n\n <th\n v-for=\"col in visibleColumns\"\n :key=\"col.property\"\n :class=\"[\n {\n 'c-sortable': isSortable(col),\n 'c-sortable--sorted': activeSort?.key === col.property,\n 'primary-col': col.primary,\n },\n col.headerClass,\n ]\"\n :title=\"isSortable(col) ? `Sorrendezés ${col.label} alapján` : undefined\"\n @click=\"isSortable(col) ? handleSort(col) : undefined\"\n >\n {{ !col.hideHeader ? col.label : '' }}\n\n <span\n v-if=\"isSortable(col)\"\n class=\"c-sort-icon fa-solid\"\n :class=\"{\n 'fa-sort': activeSort?.key !== col.property,\n 'fa-sort-down': activeSort?.key === col.property && activeSort.direction === 'desc',\n 'fa-sort-up': activeSort?.key === col.property && activeSort.direction === 'asc',\n 'c-sort-icon--active': activeSort?.key === col.property,\n 'is-asc': activeSort?.key === col.property && activeSort.direction === 'asc',\n 'is-desc': activeSort?.key === col.property && activeSort.direction === 'desc',\n }\"\n ></span>\n </th>\n\n <th v-if=\"config.actions\" class=\"c-actions-header\">\n {{ config.actionHeader ?? '' }}\n </th>\n </tr>\n </thead>\n\n <tbody v-if=\"!loading || items.length > 0\">\n <tr\n v-for=\"(item, index) in items\"\n :key=\"index\"\n :class=\"{\n 'is-selected': config.selectableAttr && selectedKeys.has(item[config.selectableAttr]),\n 'is-striped': settings.striped && index % 2 === 1,\n }\"\n >\n <td v-if=\"config.selectableAttr\" class=\"pointer\" @click.stop=\"toggleRow(item)\">\n <Checkbox\n :model-value=\"!!selectedKeys.has(item[config.selectableAttr])\"\n @update:model-value=\"toggleRow(item)\"\n @click.stop\n />\n </td>\n\n <td\n v-for=\"col in visibleColumns\"\n :key=\"col.property\"\n class=\"c-table__cell\"\n :class=\"[\n col.class,\n { 'primary-col': col.primary },\n /* { 'is-nowrap': String(getColumnValue(item, col) ?? '').length < CHARACTER_BREAKPOINT}, */\n ]\"\n >\n <slot :name=\"`cell:${col.property}`\" :item=\"item\" :col=\"col\">\n <DataCell :item=\"item\" :col=\"col\" :copy=\"!col.hideCopyToClipboard\" />\n </slot>\n </td>\n\n <td v-if=\"config.actions\" class=\"c-actions-cell\">\n <slot\n v-if=\"$slots.actions\"\n name=\"actions\"\n :item=\"item\"\n :index=\"index\"\n :actions=\"config.actions\"\n />\n <div v-else class=\"c-actions-wrap\">\n <DataListActions :actions=\"config.actions\" :item=\"item\" />\n </div>\n </td>\n </tr>\n </tbody>\n <tbody v-else>\n <tr class=\"c-table__loading-row\">\n <td\n :colspan=\"\n visibleColumns.length + (config.selectableAttr ? 1 : 0) + (config.actions ? 1 : 0)\n \"\n class=\"c-table__loading-cell\"\n >\n <div class=\"c-table__loading-wrap\">\n <Loader :loading=\"true\" size=\"2.5rem\" />\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n <div v-if=\"loading && items.length > 0\" class=\"c-table__backdrop\" aria-hidden=\"true\">\n <Loader :loading=\"true\" size=\"2.5rem\" />\n </div>\n </div>\n</template>\n\n<style lang=\"scss\" src=\"@/styles/components/data-table/data-table.scss\"></style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"admins-components70.js","names":[],"sources":["../src/components/data-table/DataTable.vue"],"sourcesContent":["<script lang=\"ts\">\nexport type {\n LayoutMode,\n DataListConfig,\n DataListSettings,\n DataTableSettings,\n DataCardsSettings,\n Column,\n Sort,\n Action,\n ActionGroup,\n FilterConfig,\n FilterValue,\n} from '@/types/data-list'\n\nexport {\n dataTableSettingsDefaults,\n dataCardsSettingsDefaults,\n dataListSettingsDefaults,\n} from '@/types/data-list'\n</script>\n\n<script setup lang=\"ts\">\nimport { computed, ref, onMounted, watch, nextTick } from 'vue'\nimport Checkbox from '@/components/Checkbox.vue'\nimport { useSelection } from '@/composables/useSelection'\nimport { dataTableSettingsDefaults } from '@/types/data-list'\nimport type { Column, DataListConfig, DataTableSettings, Sort } from '@/types/data-list'\nimport Loader from '@/components/Loader.vue'\nimport DataCell from './DataCell.vue'\nimport DataListActions from './DataListActions.vue'\n\ntype SortDirection = 'asc' | 'desc'\n\nconst props = withDefaults(\n defineProps<{\n config: DataListConfig\n items: Record<string, unknown>[]\n settings?: DataTableSettings\n loading?: boolean\n initialSort?: { key: string; direction: SortDirection } | null\n }>(),\n {\n settings: () => ({ ...dataTableSettingsDefaults }),\n loading: false,\n initialSort: null,\n },\n)\n\nconst emit = defineEmits<{\n 'selection-change': [selected: unknown[]]\n 'sort-change': [sort: { key: string; direction: SortDirection }]\n}>()\n\n//const CHARACTER_BREAKPOINT = 20\n\nconst activeSort = ref<{\n key: string\n direction: SortDirection\n} | null>(null)\n\nconst tableWrapperRef = ref<HTMLElement | null>(null)\n\nwatch(\n () => props.loading,\n async (isLoading) => {\n if (isLoading) {\n await nextTick()\n tableWrapperRef.value?.scrollTo({ top: 0, behavior: 'smooth' })\n }\n },\n)\n\nconst {\n selectedKeys,\n allSelected,\n toggle: toggleRow,\n toggleAll,\n} = useSelection(\n () => props.items,\n () => props.config.selectableAttr,\n (s) => emit('selection-change', s),\n)\n\nconst visibleColumns = computed(() => props.config.columns.filter((c) => c.visible !== false))\n\nfunction getSortConfig(col: Column): Sort | null {\n if (!col.sort) return null\n return typeof col.sort === 'boolean' ? null : col.sort\n}\n\nfunction isSortable(col: Column): boolean {\n return !!col.sort\n}\n\nfunction handleSort(col: Column) {\n const key = col.property\n const direction: SortDirection =\n activeSort.value?.key === key && activeSort.value.direction === 'asc' ? 'desc' : 'asc'\n\n activeSort.value = { key, direction }\n getSortConfig(col)?.callback?.(key, direction)\n\n emit('sort-change', { key, direction })\n}\n\nfunction applyInitialSort(sort: { key: string; direction: SortDirection } | null | undefined) {\n if (!sort) {\n if (activeSort.value !== null) activeSort.value = null\n return\n }\n const col = props.config.columns.find((c) => c.property === sort.key)\n if (!col) return\n if (activeSort.value?.key === sort.key && activeSort.value.direction === sort.direction) return\n activeSort.value = { key: sort.key, direction: sort.direction }\n getSortConfig(col)?.callback?.(sort.key, sort.direction)\n emit('sort-change', { key: sort.key, direction: sort.direction })\n}\n\nonMounted(() => applyInitialSort(props.initialSort))\nwatch(\n () => props.initialSort,\n (s) => {\n if (!s) {\n if (activeSort.value !== null) activeSort.value = null\n return\n }\n const col = props.config.columns.find((c) => c.property === s.key)\n if (!col) return\n if (activeSort.value?.key === s.key && activeSort.value.direction === s.direction) return\n activeSort.value = { key: s.key, direction: s.direction }\n },\n)\n</script>\n\n<template>\n <div\n ref=\"tableWrapperRef\"\n class=\"ac-component c-table-wrapper list-table-view\"\n :class=\"{ 'is-loading': loading }\"\n >\n <!-- :style=\"{ '--action-count': config.actions?.length ?? 0 }\" -->\n <table class=\"c-table\" :class=\"{ 'is-compact': settings.compact }\">\n <thead>\n <tr>\n <th v-if=\"config.selectableAttr\">\n <Checkbox :model-value=\"allSelected\" @update:model-value=\"toggleAll\" />\n </th>\n\n <th\n v-for=\"col in visibleColumns\"\n :key=\"col.property\"\n :class=\"[\n {\n 'c-sortable': isSortable(col),\n 'c-sortable--sorted': activeSort?.key === col.property,\n 'primary-col': col.primary,\n },\n col.headerClass,\n ]\"\n :title=\"isSortable(col) ? `Sorrendezés ${col.label} alapján` : undefined\"\n @click=\"isSortable(col) ? handleSort(col) : undefined\"\n >\n {{ !col.hideHeader ? col.label : '' }}\n\n <span\n v-if=\"isSortable(col)\"\n class=\"c-sort-icon fa-solid\"\n :class=\"{\n 'fa-sort': activeSort?.key !== col.property,\n 'fa-sort-down': activeSort?.key === col.property && activeSort.direction === 'desc',\n 'fa-sort-up': activeSort?.key === col.property && activeSort.direction === 'asc',\n 'c-sort-icon--active': activeSort?.key === col.property,\n 'is-asc': activeSort?.key === col.property && activeSort.direction === 'asc',\n 'is-desc': activeSort?.key === col.property && activeSort.direction === 'desc',\n }\"\n ></span>\n </th>\n\n <th v-if=\"config.actions\" class=\"c-actions-header\">\n {{ config.actionHeader ?? '' }}\n </th>\n </tr>\n </thead>\n\n <tbody v-if=\"!loading || items.length > 0\">\n <tr\n v-for=\"(item, index) in items\"\n :key=\"index\"\n :class=\"{\n 'is-selected': config.selectableAttr && selectedKeys.has(item[config.selectableAttr]),\n 'is-striped': settings.striped && index % 2 === 1,\n 'pointer': config.selectableAttr,\n }\"\n @click=\"config.selectableAttr ? toggleRow(item) : undefined\"\n >\n <td v-if=\"config.selectableAttr\" class=\"pointer\" @click.stop=\"toggleRow(item)\">\n <Checkbox\n :model-value=\"!!selectedKeys.has(item[config.selectableAttr])\"\n @update:model-value=\"toggleRow(item)\"\n @click.stop\n />\n </td>\n\n <td\n v-for=\"col in visibleColumns\"\n :key=\"col.property\"\n class=\"c-table__cell\"\n :class=\"[\n col.class,\n { 'primary-col': col.primary },\n /* { 'is-nowrap': String(getColumnValue(item, col) ?? '').length < CHARACTER_BREAKPOINT}, */\n ]\"\n >\n <slot :name=\"`cell:${col.property}`\" :item=\"item\" :col=\"col\">\n <DataCell :item=\"item\" :col=\"col\" :copy=\"!col.hideCopyToClipboard\" />\n </slot>\n </td>\n\n <td v-if=\"config.actions\" class=\"c-actions-cell\" @click.stop>\n <slot\n v-if=\"$slots.actions\"\n name=\"actions\"\n :item=\"item\"\n :index=\"index\"\n :actions=\"config.actions\"\n />\n <div v-else class=\"c-actions-wrap\">\n <DataListActions :actions=\"config.actions\" :item=\"item\" />\n </div>\n </td>\n </tr>\n </tbody>\n <tbody v-else>\n <tr class=\"c-table__loading-row\">\n <td\n :colspan=\"\n visibleColumns.length + (config.selectableAttr ? 1 : 0) + (config.actions ? 1 : 0)\n \"\n class=\"c-table__loading-cell\"\n >\n <div class=\"c-table__loading-wrap\">\n <Loader :loading=\"true\" size=\"2.5rem\" />\n </div>\n </td>\n </tr>\n </tbody>\n </table>\n <div v-if=\"loading && items.length > 0\" class=\"c-table__backdrop\" aria-hidden=\"true\">\n <Loader :loading=\"true\" size=\"2.5rem\" />\n </div>\n </div>\n</template>\n\n<style lang=\"scss\" src=\"@/styles/components/data-table/data-table.scss\"></style>\n"],"mappings":""}
|
|
@@ -9,6 +9,8 @@ declare const __VLS_export: __VLS_WithSlots<import('vue').DefineComponent<ModalP
|
|
|
9
9
|
}, string, import('vue').PublicProps, Readonly<ModalProps> & Readonly<{
|
|
10
10
|
onClose?: (() => any) | undefined;
|
|
11
11
|
}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>, {
|
|
12
|
+
header?: (props: {}) => any;
|
|
13
|
+
} & {
|
|
12
14
|
default?: (props: {}) => any;
|
|
13
15
|
} & {
|
|
14
16
|
footer?: (props: {}) => any;
|
package/dist/test.html
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="hu">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title>search-posts-widget standalone test</title>
|
|
6
|
+
<style>
|
|
7
|
+
body { font-family: system-ui, sans-serif; margin: 2rem; }
|
|
8
|
+
#log {
|
|
9
|
+
margin-top: 1rem;
|
|
10
|
+
padding: 1rem;
|
|
11
|
+
background: #f4f4f4;
|
|
12
|
+
border: 1px solid #ddd;
|
|
13
|
+
font-family: monospace;
|
|
14
|
+
white-space: pre-wrap;
|
|
15
|
+
font-size: 12px;
|
|
16
|
+
max-height: 300px;
|
|
17
|
+
overflow-y: auto;
|
|
18
|
+
}
|
|
19
|
+
dialog {
|
|
20
|
+
padding: 0;
|
|
21
|
+
border: 1px solid #999;
|
|
22
|
+
border-radius: 8px;
|
|
23
|
+
width: 90vw;
|
|
24
|
+
height: 80vh;
|
|
25
|
+
}
|
|
26
|
+
dialog::backdrop { background: rgba(0,0,0,0.4); }
|
|
27
|
+
</style>
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<h1>search-posts-widget standalone test</h1>
|
|
31
|
+
|
|
32
|
+
<p>
|
|
33
|
+
Bundle:
|
|
34
|
+
<select id="bundle-version">
|
|
35
|
+
<option value="1.0.181">1.0.181</option>
|
|
36
|
+
<option value="1.0.188" selected>1.0.188</option>
|
|
37
|
+
</select>
|
|
38
|
+
<button id="reload">Reload bundle</button>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<p>
|
|
42
|
+
<strong>apiurl:</strong>
|
|
43
|
+
<input id="apiurl" style="width: 360px" value="http://172.22.0.15:8080" />
|
|
44
|
+
<br />
|
|
45
|
+
<strong>environment:</strong>
|
|
46
|
+
<input id="environment" value="dev" />
|
|
47
|
+
<br />
|
|
48
|
+
<strong>id (causationid):</strong>
|
|
49
|
+
<input id="causationid" value="test-1" />
|
|
50
|
+
<br />
|
|
51
|
+
<strong>searchurl:</strong>
|
|
52
|
+
<input id="searchurl" style="width: 360px" value="" />
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
<button id="open-selector">Open selector</button>
|
|
56
|
+
<button id="open-non-selector">Open non-selector</button>
|
|
57
|
+
|
|
58
|
+
<dialog id="dialog">
|
|
59
|
+
<search-posts-widget
|
|
60
|
+
id="widget"
|
|
61
|
+
selector="true"
|
|
62
|
+
environment="dev"
|
|
63
|
+
id="causationid"
|
|
64
|
+
apiurl="http://172.22.0.15:8080"
|
|
65
|
+
searchurl=""
|
|
66
|
+
></search-posts-widget>
|
|
67
|
+
</dialog>
|
|
68
|
+
|
|
69
|
+
<h3>Console log</h3>
|
|
70
|
+
<div id="log"></div>
|
|
71
|
+
|
|
72
|
+
<script>
|
|
73
|
+
const log = (msg, data) => {
|
|
74
|
+
const el = document.getElementById('log')
|
|
75
|
+
const line = document.createElement('div')
|
|
76
|
+
line.textContent = `[${new Date().toISOString()}] ${msg}` +
|
|
77
|
+
(data !== undefined ? ' ' + JSON.stringify(data) : '')
|
|
78
|
+
el.appendChild(line)
|
|
79
|
+
console.log(msg, data ?? '')
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
window.addEventListener('error', (e) => log('ERROR', { msg: e.message, file: e.filename, line: e.lineno }))
|
|
83
|
+
window.addEventListener('unhandledrejection', (e) => log('UNHANDLED REJECTION', { reason: String(e.reason) }))
|
|
84
|
+
|
|
85
|
+
const widgetScriptId = 'search-posts-widget-script'
|
|
86
|
+
const CDN_BASE = 'https://cdn.hvg.hu/search-posts-widget'
|
|
87
|
+
|
|
88
|
+
function loadBundle(version) {
|
|
89
|
+
return new Promise((resolve, reject) => {
|
|
90
|
+
const existing = document.getElementById(widgetScriptId)
|
|
91
|
+
if (existing) existing.remove()
|
|
92
|
+
if (customElements.get('search-posts-widget')) {
|
|
93
|
+
// Force re-registration by re-defining on a new class
|
|
94
|
+
// (customElements.define cannot be called twice for the same name,
|
|
95
|
+
// but since the script reassigns via const, we just reload.)
|
|
96
|
+
}
|
|
97
|
+
const s = document.createElement('script')
|
|
98
|
+
s.id = widgetScriptId
|
|
99
|
+
//s.src = `${CDN_BASE}/${version}/search-posts-widget.umd.js`
|
|
100
|
+
s.src = '/widget/dist/search-posts-widget.umd.js'
|
|
101
|
+
s.onload = () => resolve(version)
|
|
102
|
+
s.onerror = () => reject(new Error(`Failed to load ${version}`))
|
|
103
|
+
document.head.appendChild(s)
|
|
104
|
+
})
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function applyAttrs() {
|
|
108
|
+
const w = document.getElementById('widget')
|
|
109
|
+
w.setAttribute('apiurl', document.getElementById('apiurl').value)
|
|
110
|
+
w.setAttribute('environment', document.getElementById('environment').value)
|
|
111
|
+
w.setAttribute('id', document.getElementById('causationid').value)
|
|
112
|
+
w.setAttribute('searchurl', document.getElementById('searchurl').value)
|
|
113
|
+
log('widget attrs', {
|
|
114
|
+
apiurl: w.getAttribute('apiurl'),
|
|
115
|
+
environment: w.getAttribute('environment'),
|
|
116
|
+
id: w.getAttribute('id'),
|
|
117
|
+
searchurl: w.getAttribute('searchurl'),
|
|
118
|
+
selector: w.getAttribute('selector'),
|
|
119
|
+
})
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
function openWidget(selector) {
|
|
123
|
+
const w = document.getElementById('widget')
|
|
124
|
+
w.setAttribute('selector', selector ? 'true' : 'false')
|
|
125
|
+
applyAttrs()
|
|
126
|
+
// Re-create the element so the new selector prop takes effect
|
|
127
|
+
const fresh = w.cloneNode(true)
|
|
128
|
+
w.replaceWith(fresh)
|
|
129
|
+
document.getElementById('dialog').showModal()
|
|
130
|
+
// v1.0.188 needs open() to display selector content
|
|
131
|
+
try {
|
|
132
|
+
console.log('fresh element before open:', fresh)
|
|
133
|
+
fresh.open?.()
|
|
134
|
+
log('called open()', { hasOpen: typeof fresh.open === 'function' })
|
|
135
|
+
} catch (e) {
|
|
136
|
+
log('open() threw', { error: String(e) })
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
document.getElementById('reload').addEventListener('click', async () => {
|
|
141
|
+
const v = document.getElementById('bundle-version').value
|
|
142
|
+
try {
|
|
143
|
+
await loadBundle(v)
|
|
144
|
+
log('bundle loaded', { version: v, defined: !!customElements.get('search-posts-widget') })
|
|
145
|
+
} catch (e) {
|
|
146
|
+
log('bundle load failed', { error: String(e) })
|
|
147
|
+
}
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
document.getElementById('open-selector').addEventListener('click', () => openWidget(true))
|
|
151
|
+
document.getElementById('open-non-selector').addEventListener('click', () => openWidget(false))
|
|
152
|
+
|
|
153
|
+
window.addEventListener('search_posts_selected', (e) => {
|
|
154
|
+
log('search_posts_selected', e.detail)
|
|
155
|
+
})
|
|
156
|
+
|
|
157
|
+
// Initial load of selected version
|
|
158
|
+
loadBundle(document.getElementById('bundle-version').value)
|
|
159
|
+
.then((v) => log('initial bundle loaded', { version: v, defined: !!customElements.get('search-posts-widget') }))
|
|
160
|
+
.catch((e) => log('initial bundle failed', { error: String(e) }))
|
|
161
|
+
</script>
|
|
162
|
+
</body>
|
|
163
|
+
</html>
|
package/dist/test81.html
ADDED
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="hu">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<title>search-posts-widget standalone test</title>
|
|
6
|
+
<style>
|
|
7
|
+
body { font-family: system-ui, sans-serif; margin: 2rem; }
|
|
8
|
+
#log {
|
|
9
|
+
margin-top: 1rem;
|
|
10
|
+
padding: 1rem;
|
|
11
|
+
background: #f4f4f4;
|
|
12
|
+
border: 1px solid #ddd;
|
|
13
|
+
font-family: monospace;
|
|
14
|
+
white-space: pre-wrap;
|
|
15
|
+
font-size: 12px;
|
|
16
|
+
max-height: 300px;
|
|
17
|
+
overflow-y: auto;
|
|
18
|
+
}
|
|
19
|
+
dialog {
|
|
20
|
+
padding: 0;
|
|
21
|
+
border: 1px solid #999;
|
|
22
|
+
border-radius: 8px;
|
|
23
|
+
width: 90vw;
|
|
24
|
+
height: 80vh;
|
|
25
|
+
}
|
|
26
|
+
dialog::backdrop { background: rgba(0,0,0,0.4); }
|
|
27
|
+
</style>
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<h1>search-posts-widget standalone test</h1>
|
|
31
|
+
|
|
32
|
+
<p>
|
|
33
|
+
Bundle:
|
|
34
|
+
<select id="bundle-version">
|
|
35
|
+
<option value="1.0.181" selected>1.0.181</option>
|
|
36
|
+
<option value="1.0.188" >1.0.188</option>
|
|
37
|
+
</select>
|
|
38
|
+
<button id="reload">Reload bundle</button>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<p>
|
|
42
|
+
<strong>apiurl:</strong>
|
|
43
|
+
<input id="apiurl" style="width: 360px" value="http://172.22.0.15:8080" />
|
|
44
|
+
<br />
|
|
45
|
+
<strong>environment:</strong>
|
|
46
|
+
<input id="environment" value="dev" />
|
|
47
|
+
<br />
|
|
48
|
+
<strong>id (causationid):</strong>
|
|
49
|
+
<input id="causationid" value="test-causation-1" />
|
|
50
|
+
<br />
|
|
51
|
+
<strong>searchurl:</strong>
|
|
52
|
+
<input id="searchurl" style="width: 360px" value="" />
|
|
53
|
+
</p>
|
|
54
|
+
|
|
55
|
+
<button id="open-selector">Open selector</button>
|
|
56
|
+
<button id="open-non-selector">Open non-selector</button>
|
|
57
|
+
|
|
58
|
+
<dialog id="dialog">
|
|
59
|
+
<search-posts-widget
|
|
60
|
+
id="widget"
|
|
61
|
+
selector="true"
|
|
62
|
+
environment="dev"
|
|
63
|
+
id="causationid"
|
|
64
|
+
apiurl="http://172.22.0.15:8080"
|
|
65
|
+
searchurl=""
|
|
66
|
+
></search-posts-widget>
|
|
67
|
+
</dialog>
|
|
68
|
+
|
|
69
|
+
<h3>Console log</h3>
|
|
70
|
+
<div id="log"></div>
|
|
71
|
+
|
|
72
|
+
<script>
|
|
73
|
+
const log = (msg, data) => {
|
|
74
|
+
const el = document.getElementById('log')
|
|
75
|
+
const line = document.createElement('div')
|
|
76
|
+
line.textContent = `[${new Date().toISOString()}] ${msg}` +
|
|
77
|
+
(data !== undefined ? ' ' + JSON.stringify(data) : '')
|
|
78
|
+
el.appendChild(line)
|
|
79
|
+
console.log(msg, data ?? '')
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
window.addEventListener('error', (e) => log('ERROR', { msg: e.message, file: e.filename, line: e.lineno }))
|
|
83
|
+
window.addEventListener('unhandledrejection', (e) => log('UNHANDLED REJECTION', { reason: String(e.reason) }))
|
|
84
|
+
|
|
85
|
+
const widgetScriptId = 'search-posts-widget-script'
|
|
86
|
+
const CDN_BASE = 'https://cdn.hvg.hu/search-posts-widget'
|
|
87
|
+
|
|
88
|
+
function loadBundle(version) {
|
|
89
|
+
return new Promise((resolve, reject) => {
|
|
90
|
+
const existing = document.getElementById(widgetScriptId)
|
|
91
|
+
if (existing) existing.remove()
|
|
92
|
+
if (customElements.get('search-posts-widget')) {
|
|
93
|
+
// Force re-registration by re-defining on a new class
|
|
94
|
+
// (customElements.define cannot be called twice for the same name,
|
|
95
|
+
// but since the script reassigns via const, we just reload.)
|
|
96
|
+
}
|
|
97
|
+
const s = document.createElement('script')
|
|
98
|
+
s.id = widgetScriptId
|
|
99
|
+
s.src = `${CDN_BASE}/${version}/search-posts-widget.umd.js`
|
|
100
|
+
s.onload = () => resolve(version)
|
|
101
|
+
s.onerror = () => reject(new Error(`Failed to load ${version}`))
|
|
102
|
+
document.head.appendChild(s)
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function applyAttrs() {
|
|
107
|
+
const w = document.getElementById('widget')
|
|
108
|
+
w.setAttribute('apiurl', document.getElementById('apiurl').value)
|
|
109
|
+
w.setAttribute('environment', document.getElementById('environment').value)
|
|
110
|
+
w.setAttribute('id', document.getElementById('causationid').value)
|
|
111
|
+
w.setAttribute('searchurl', document.getElementById('searchurl').value)
|
|
112
|
+
log('widget attrs', {
|
|
113
|
+
apiurl: w.getAttribute('apiurl'),
|
|
114
|
+
environment: w.getAttribute('environment'),
|
|
115
|
+
id: w.getAttribute('id'),
|
|
116
|
+
searchurl: w.getAttribute('searchurl'),
|
|
117
|
+
selector: w.getAttribute('selector'),
|
|
118
|
+
})
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function openWidget(selector) {
|
|
122
|
+
const w = document.getElementById('widget')
|
|
123
|
+
w.setAttribute('selector', selector ? 'true' : 'false')
|
|
124
|
+
applyAttrs()
|
|
125
|
+
// Re-create the element so the new selector prop takes effect
|
|
126
|
+
const fresh = w.cloneNode(true)
|
|
127
|
+
w.replaceWith(fresh)
|
|
128
|
+
document.getElementById('dialog').showModal()
|
|
129
|
+
// v1.0.188 needs open() to display selector content
|
|
130
|
+
try {
|
|
131
|
+
fresh.open?.()
|
|
132
|
+
log('called open()', { hasOpen: typeof fresh.open === 'function' })
|
|
133
|
+
} catch (e) {
|
|
134
|
+
log('open() threw', { error: String(e) })
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
document.getElementById('reload').addEventListener('click', async () => {
|
|
139
|
+
const v = document.getElementById('bundle-version').value
|
|
140
|
+
try {
|
|
141
|
+
await loadBundle(v)
|
|
142
|
+
log('bundle loaded', { version: v, defined: !!customElements.get('search-posts-widget') })
|
|
143
|
+
} catch (e) {
|
|
144
|
+
log('bundle load failed', { error: String(e) })
|
|
145
|
+
}
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
document.getElementById('open-selector').addEventListener('click', () => openWidget(true))
|
|
149
|
+
document.getElementById('open-non-selector').addEventListener('click', () => openWidget(false))
|
|
150
|
+
|
|
151
|
+
window.addEventListener('search_posts_selected', (e) => {
|
|
152
|
+
log('search_posts_selected', e.detail)
|
|
153
|
+
})
|
|
154
|
+
|
|
155
|
+
// Initial load of selected version
|
|
156
|
+
loadBundle(document.getElementById('bundle-version').value)
|
|
157
|
+
.then((v) => log('initial bundle loaded', { version: v, defined: !!customElements.get('search-posts-widget') }))
|
|
158
|
+
.catch((e) => log('initial bundle failed', { error: String(e) }))
|
|
159
|
+
</script>
|
|
160
|
+
</body>
|
|
161
|
+
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.article-picker-container[data-v-0afb93e7]{flex-direction:column;gap:1rem;display:flex}.article-picker-section[data-v-0afb93e7]{flex-direction:column;gap:.375rem;display:flex}.article-picker-ids[data-v-0afb93e7]{gap:.5rem;width:100%;display:flex}.article-picker-id-field[data-v-0afb93e7]{flex-direction:column;flex:1;gap:.375rem;display:flex}.article-picker-image[data-v-0afb93e7]{border-radius:var(--ac-field-border-radius);object-fit:cover;max-width:100%;height:200px}.article-picker-no-image[data-v-0afb93e7]{padding:var(--ac-input-padding);color:var(--neutral-500);font-size:var(--ac-field-font-size)}.article-picker-buttons[data-v-0afb93e7]{gap:.5rem;width:100%;display:flex}.article-picker-image-modal[data-v-0afb93e7]{width:90vw;max-width:1200px;height:80vh}.article-picker-image-modal[data-v-0afb93e7] .c-modal-body,.article-picker-article-modal[data-v-0afb93e7] .c-modal-body{padding:0}.article-picker-article-modal[data-v-0afb93e7]{width:95vw;max-width:1600px;height:90vh}.article-picker-modal-header-actions[data-v-0afb93e7]{align-items:center;gap:.5rem;margin-left:auto;display:flex}
|