diff --git a/.changeset/restore-bar-clip-bounds.md b/.changeset/restore-bar-clip-bounds.md new file mode 100644 index 0000000000..4282495d3e --- /dev/null +++ b/.changeset/restore-bar-clip-bounds.md @@ -0,0 +1,5 @@ +--- +'@visactor/vseed': patch +--- + +Restore bar stroke clipping for single-series charts, conditional corner styles, and dual-axis bars without configured stack corners. Preserve default rounding on unmatched bars and explicit per-bar corners on matched bars without expanding the rendered bar bounds. Keep moving bars unclipped during moveIn animations. diff --git a/README.md b/README.md index fe03521b7f..1075ec892c 100644 --- a/README.md +++ b/README.md @@ -9,5 +9,5 @@ VBI provides reusable packages and agent skills for AI-oriented business intelli | Name | Description | Test Coverage | Npm Version | | :------------------------------------------------------------- | :----------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------ | | [vbi](https://visactor.github.io/VBI) | HeadlessBI Interface | [![Coverage](https://img.shields.io/badge/Coverage-100%25-brightgreen.svg)](https://github.com/VisActor/VBI/actions/workflows/coverage.yml) | [![npm Version](https://img.shields.io/npm/v/@visactor/vbi.svg)](https://www.npmjs.com/package/@visactor/vbi) | -| [vseed](https://visactor.github.io/VBI/vseed/guide/quickStart) | Visualization Engine | [![Coverage](https://img.shields.io/badge/Coverage-90.47%25-brightgreen.svg)](https://github.com/VisActor/VSeed/actions/workflows/coverage.yml) | [![npm Version](https://img.shields.io/npm/v/@visactor/vseed.svg)](https://www.npmjs.com/package/@visactor/vseed) | +| [vseed](https://visactor.github.io/VBI/vseed/guide/quickStart) | Visualization Engine | [![Coverage](https://img.shields.io/badge/Coverage-90.56%25-brightgreen.svg)](https://github.com/VisActor/VSeed/actions/workflows/coverage.yml) | [![npm Version](https://img.shields.io/npm/v/@visactor/vseed.svg)](https://www.npmjs.com/package/@visactor/vseed) | | [vquery](https://visactor.github.io/VBI/VQuery) | Lightweight Query Engine | [![Coverage](https://img.shields.io/badge/Coverage-100.00%25-brightgreen.svg)](https://github.com/VisActor/VSeed/actions/workflows/coverage.yml) | [![npm Version](https://img.shields.io/npm/v/@visactor/vquery.svg)](https://www.npmjs.com/package/@visactor/vquery) | diff --git a/apps/website/docs/public/storybook/de-DE/assets/iframe.js b/apps/website/docs/public/storybook/de-DE/assets/iframe.js index e574af3c0a..275ae9602b 100644 --- a/apps/website/docs/public/storybook/de-DE/assets/iframe.js +++ b/apps/website/docs/public/storybook/de-DE/assets/iframe.js @@ -1,5 +1,5 @@ import { n as __esmMin, o as __toESM, r as __exportAll } from "./rolldown-runtime.js"; -import { $ as d$6, A as init_yjs, An as H$4, At as m$8, B as date, Bn as preview_exports$1, Bt as PivotTableAll, Cn as isUndefined, Ct as D$4, D as YMap, Dn as init_esm$1, Dt as i$9, E as YArray, En as esm_default, Et as r$11, F as _enum, Fn as h$5, Ft as C$6, G as number, Gt as boxplot, Hn as init_entry_preview_docs, Ht as ListTableAll, I as any, In as init_client, J as string, Jn as init_entry_preview, K as object, Kn as setCustomElementsManifest, L as array$1, Ln as proxyCustomElement, Lt as init_es$2, Mn as createEvent, N as v4, Nn as forceUpdate, Nt as i$7, O as applyUpdate, On as StreamLight, P as init_zod, Pn as getRenderingRef, Q as init_dist$1, Qn as setup, Qt as Color, R as boolean, Rn as transformTag, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isNil, U as lazy, Un as entry_preview_argtypes_exports, V as discriminatedUnion, Vn as entry_preview_docs_exports, W as literal, Wn as init_entry_preview_argtypes, Wt as init_es$1, X as union, Xn as init_preload_helper, Y as tuple, Yn as __vitePreload, Yt as chartModule, Z as require_tinycolor, Zn as init_runtime, Zt as init_es, _n as pickWithout, an as regressionPolynomial, ct as n$11, dn as regressionLinear, dt as e$8, en as ecdf, f as init_dist$3, fn as clamper, g as PostgresQueryCompiler, gt as t$14, j as init_dist$2, jn as Host, jt as T$4, k as encodeStateAsUpdate, ln as regressionLogistic, m as PostgresAdapter, mn as array, mt as n$10, nt as k$7, ot as o$9, p as init_esm$2, q as record, qn as entry_preview_exports, qt as bin, rn as kde, rt as i$10, sn as regressionLowess, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as isArray, yn as merge, yt as i$8, z as custom, zn as init_preview$1 } from "./vendor.js"; +import { $ as d$6, $n as init_runtime, $t as normalizePadding, A as init_yjs, An as StreamLight, At as m$8, B as date, Bn as transformTag, Bt as PivotTableAll, Cn as isArray, Ct as D$4, D as YMap, Dn as isNil, Dt as i$9, E as YArray, Et as r$11, F as _enum, Fn as forceUpdate, Ft as C$6, G as number, Gn as entry_preview_argtypes_exports, Gt as boxplot, Hn as preview_exports$1, Ht as ListTableAll, I as any, In as getRenderingRef, J as string, Jn as setCustomElementsManifest, K as object, Kn as init_entry_preview_argtypes, L as array$1, Ln as h$5, Lt as init_es$2, Mn as H$4, N as v4, Nn as Host, Nt as i$7, O as applyUpdate, On as esm_default, P as init_zod, Pn as createEvent, Q as init_dist$1, Qn as init_preload_helper, R as boolean, Rn as init_client, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isUndefined, U as lazy, Un as entry_preview_docs_exports, V as discriminatedUnion, Vn as init_preview$1, W as literal, Wn as init_entry_preview_docs, Wt as init_es$1, X as union, Xn as init_entry_preview, Y as tuple, Yn as entry_preview_exports, Yt as chartModule, Z as require_tinycolor, Zn as __vitePreload, Zt as init_es, an as kde, ct as n$11, dn as regressionLogistic, dt as e$8, en as Color, er as setup, f as init_dist$3, g as PostgresQueryCompiler, gn as array, gt as t$14, j as init_dist$2, jt as T$4, k as encodeStateAsUpdate, kn as init_esm$1, ln as regressionLowess, m as PostgresAdapter, mn as clamper, mt as n$10, nn as ecdf, nt as k$7, ot as o$9, p as init_esm$2, pn as regressionLinear, q as record, qt as bin, rt as i$10, sn as regressionPolynomial, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as merge, yn as pickWithout, yt as i$8, z as custom, zn as proxyCustomElement } from "./vendor.js"; //#region iframe.html?html-proxy&inline-css&index=0.css var init_iframe_html_html_proxy_inline_css_index_0 = __esmMin((() => {})); //#endregion @@ -9397,6 +9397,195 @@ var init_stack$1 = __esmMin((() => { }; })); //#endregion +//#region ../vseed/dist/esm/dataSelector/selector.js +function nearlyEqual(a, b, epsilon = 1e-8) { + if (Number.isNaN(a) || Number.isNaN(b)) return false; + if (a === b) return true; + return Math.abs(a - b) <= epsilon; +} +var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; +var init_selector$1 = __esmMin((() => { + init_dist$1(); + init_sandbox(); + init_dataReshape(); + selector_selector = (vchartDatum, selector, selectorMode = "And") => { + if (!selector) return true; + const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); + return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { + if (isValueSelector(selector)) return selectByValue(selector, datum); + else if (isFieldSelector(selector)) return selectByField(selector, datum); + else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); + else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); + else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); + return false; + }); + }; + isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; + isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; + isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); + isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.operator) || [ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.op)); + isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); + selectByMeasure = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "=": + if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "==": + if (datum[selector.field] === selectorValueArr[0]) return true; + break; + case "!=": + if (datum[selector.field] !== selectorValueArr[0]) return true; + break; + case ">": + if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<": + if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case ">=": + if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<=": + if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "between": + if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; + break; + } + return false; + }; + selectByDmension = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "in": + if (selectorValueArr.includes(datum[selector.field])) return true; + break; + case "not in": + if (!selectorValueArr.includes(datum[selector.field])) return true; + break; + } + return false; + }; + selectByField = (selector, datum) => { + const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; + const datumKeys = Object.keys(datum); + return fields.some((field) => datumKeys.includes(field)); + }; + matchesFieldSelector = (field, fieldSelector) => { + return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); + }; + selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); + selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); + matchesCellSelector = (cell, filterRes) => { + if (filterRes["__row_index"] !== cell["__row_index"]) return false; + return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); + }; + matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); + isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; + isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); + isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); + isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); + validateFilterResult = (result, filter) => { + if (isValueDynamicFilter(filter)) { + if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); + return; + } + if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); + if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { + const item = result[i]; + if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); + if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); + if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); + } + }; + executeDynamicFilter = async (filter, allData) => { + try { + const { success, data, error } = await executeFilterCode({ + code: filter.code, + data: allData + }); + if (!success) { + console.warn("[vseed] Dynamic filter execution failed:", error); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error + }; + } + try { + validateFilterResult(data, filter); + } catch (validationError) { + console.error("[vseed] Dynamic filter result validation failed:", validationError); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: validationError instanceof Error ? validationError.message : String(validationError) + }; + } + return { + success, + data + }; + } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: errorMessage + }; + } + }; + matchDynamicFilterResult = (result, datum, selectorType = "table") => { + if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); + if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); + return result.some((item) => matchesDatum(datum, item)); + }; + selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { + if (!selectorConfig) return true; + if (isValueDynamicFilter(selectorConfig)) { + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + } + const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; + if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + }; +})); +//#endregion +//#region ../vseed/dist/esm/dataSelector/index.js +var init_dataSelector$1 = __esmMin((() => { + init_selector$1(); +})); +//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.js var reverseStackCornerRadius, mergeStackCornerRadius, getStackRangeCornerRadius, callbacks, createCornerRadius, createStackCornerRadius, createBarCornerRadius, hasMoveInAnimation; var init_stackCornerRadiusUtils = __esmMin((() => { @@ -9468,6 +9657,8 @@ var init_stackCornerRadiusUtils = __esmMin((() => { //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js var hasBarMoveInAnimation, stackCornerRadius_stackCornerRadius; var init_stackCornerRadius$2 = __esmMin((() => { + init_es(); + init_dataSelector$1(); init_stackCornerRadiusUtils(); hasBarMoveInAnimation = (spec) => [ spec.animationAppear, @@ -9478,13 +9669,23 @@ var init_stackCornerRadius$2 = __esmMin((() => { stackCornerRadius_stackCornerRadius = (spec, context) => { const { advancedVSeed, vseed } = context; const { chartType } = vseed; - const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius; - const styles = advancedVSeed.markStyle?.barStyle; - if (null == stackCornerRadius || (Array.isArray(styles) ? styles : styles ? [styles] : []).some((rule) => null != rule.barRadius)) return spec; - if (!(advancedVSeed.datasetReshapeInfo?.[0]?.unfoldInfo.colorItems.length === 1) && !hasBarMoveInAnimation(spec)) return { - ...spec, - stackCornerRadius: createStackCornerRadius(stackCornerRadius) - }; + const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius ?? 0; + if (!hasBarMoveInAnimation(spec)) { + const styles = advancedVSeed.markStyle?.barStyle; + const rules = (Array.isArray(styles) ? styles : styles ? [styles] : []).filter((rule) => null != rule.barRadius).reverse(); + const defaultRadius = createStackCornerRadius(stackCornerRadius); + const clipRadius = rules.length ? (attributes, datum) => { + const radius = defaultRadius(attributes, datum); + const rule = rules.find((rule) => rule.dynamicFilter ? selectorWithDynamicFilter(datum, rule.dynamicFilter, rule.selector) : selector_selector(datum, rule.selector)); + if (!rule) return radius; + const barRadius = normalizePadding(rule.barRadius); + return normalizePadding(radius).map((corner, index) => Math.min(corner, barRadius[index])); + } : defaultRadius; + return { + ...spec, + stackCornerRadius: clipRadius + }; + } return { ...spec, bar: { @@ -10492,195 +10693,6 @@ var init_tooltip$3 = __esmMin((() => { init_tooltipSankey(); })); //#endregion -//#region ../vseed/dist/esm/dataSelector/selector.js -function nearlyEqual(a, b, epsilon = 1e-8) { - if (Number.isNaN(a) || Number.isNaN(b)) return false; - if (a === b) return true; - return Math.abs(a - b) <= epsilon; -} -var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; -var init_selector$1 = __esmMin((() => { - init_dist$1(); - init_sandbox(); - init_dataReshape(); - selector_selector = (vchartDatum, selector, selectorMode = "And") => { - if (!selector) return true; - const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); - return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { - if (isValueSelector(selector)) return selectByValue(selector, datum); - else if (isFieldSelector(selector)) return selectByField(selector, datum); - else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); - else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); - else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); - return false; - }); - }; - isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; - isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; - isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); - isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.operator) || [ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.op)); - isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); - selectByMeasure = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "=": - if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "==": - if (datum[selector.field] === selectorValueArr[0]) return true; - break; - case "!=": - if (datum[selector.field] !== selectorValueArr[0]) return true; - break; - case ">": - if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<": - if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case ">=": - if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<=": - if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "between": - if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; - break; - } - return false; - }; - selectByDmension = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "in": - if (selectorValueArr.includes(datum[selector.field])) return true; - break; - case "not in": - if (!selectorValueArr.includes(datum[selector.field])) return true; - break; - } - return false; - }; - selectByField = (selector, datum) => { - const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; - const datumKeys = Object.keys(datum); - return fields.some((field) => datumKeys.includes(field)); - }; - matchesFieldSelector = (field, fieldSelector) => { - return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); - }; - selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); - selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); - matchesCellSelector = (cell, filterRes) => { - if (filterRes["__row_index"] !== cell["__row_index"]) return false; - return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); - }; - matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); - isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; - isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); - isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); - isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); - validateFilterResult = (result, filter) => { - if (isValueDynamicFilter(filter)) { - if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); - return; - } - if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); - if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { - const item = result[i]; - if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); - if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); - if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); - } - }; - executeDynamicFilter = async (filter, allData) => { - try { - const { success, data, error } = await executeFilterCode({ - code: filter.code, - data: allData - }); - if (!success) { - console.warn("[vseed] Dynamic filter execution failed:", error); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error - }; - } - try { - validateFilterResult(data, filter); - } catch (validationError) { - console.error("[vseed] Dynamic filter result validation failed:", validationError); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: validationError instanceof Error ? validationError.message : String(validationError) - }; - } - return { - success, - data - }; - } catch (error) { - const errorMessage = error instanceof Error ? error.message : String(error); - console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: errorMessage - }; - } - }; - matchDynamicFilterResult = (result, datum, selectorType = "table") => { - if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); - if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); - return result.some((item) => matchesDatum(datum, item)); - }; - selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { - if (!selectorConfig) return true; - if (isValueDynamicFilter(selectorConfig)) { - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - } - const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; - if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - }; -})); -//#endregion -//#region ../vseed/dist/esm/dataSelector/index.js -var init_dataSelector$1 = __esmMin((() => { - init_selector$1(); -})); -//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/label/label.js var label_label, generateMeasureValue, generateMeasurePercent, buildLabel$2; var init_label$3 = __esmMin((() => { diff --git a/apps/website/docs/public/storybook/de-DE/assets/vendor.js b/apps/website/docs/public/storybook/de-DE/assets/vendor.js index 173d315829..a2db127c02 100644 --- a/apps/website/docs/public/storybook/de-DE/assets/vendor.js +++ b/apps/website/docs/public/storybook/de-DE/assets/vendor.js @@ -50363,7 +50363,7 @@ var init_color$6 = __esmMin((() => { var init_type$70 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.24/node_modules/@visactor/vutils/es/padding.js -function normalizePadding(padding) { +function normalizePadding$1(padding) { if (isValidNumber$1(padding)) return [ padding, padding, @@ -97171,7 +97171,7 @@ var init_tag$3 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -98052,7 +98052,7 @@ var init_line$16 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis$1.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -98357,7 +98357,7 @@ var init_line$16 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize$1(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -101898,7 +101898,7 @@ var init_scrollbar$3 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -101910,7 +101910,7 @@ var init_scrollbar$3 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -102182,7 +102182,7 @@ var init_poptip$4 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -106455,7 +106455,7 @@ var init_pager$3 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE$1, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -106557,7 +106557,7 @@ var init_base$20 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator$1.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -106574,7 +106574,7 @@ var init_base$20 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -106790,7 +106790,7 @@ var init_discrete$4 = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator$1.group({ x: 0, @@ -108038,7 +108038,7 @@ var init_title$9 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -109310,7 +109310,7 @@ var init_tooltip$6 = __esmMin((() => { const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure, align } = this.attribute; if (!visible) return void this.hideAll(); autoMeasure && Tooltip$2.measureTooltip(this.attribute), autoCalculatePosition && Tooltip$2.calculateTooltipPosition(this.attribute); - const padding = normalizePadding(this.attribute.padding); + const padding = normalizePadding$1(this.attribute.padding); this._tooltipPanel = this.createOrUpdateChild("tooltip-background", Object.assign({ visible: !0 }, panel), "rect"), this._tooltipTitleContainer = this.createOrUpdateChild("tooltip-title", { visible: !0, x: padding[3], @@ -109405,7 +109405,7 @@ var init_tooltip$6 = __esmMin((() => { return "left" === positionX ? x -= tooltipBoxWidth + offsetX : "center" === positionX ? x -= tooltipBoxWidth / 2 : x += offsetX, "top" === positionY ? y -= tooltipBoxHeight + offsetY : "middle" === positionY ? y -= tooltipBoxHeight / 2 : y += offsetY, x + tooltipBoxWidth > parentBounds.x2 && (x -= tooltipBoxWidth + offsetX), y + tooltipBoxHeight > parentBounds.y2 && (y -= tooltipBoxHeight + offsetY), x < parentBounds.x1 && (x = parentBounds.x1), y < parentBounds.y1 && (y = parentBounds.y1), attribute.x = x, attribute.y = y, attribute; } static measureTooltip(attribute) { - const { content, contentStyle } = attribute, padding = normalizePadding(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); + const { content, contentStyle } = attribute, padding = normalizePadding$1(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); let maxWidth = 0, containerHeight = padding[0] + padding[2], titleMaxHeight = 0; const { value: titleValue, shape: titleShape } = titleAttr, { visible: titleHasShape = !1, symbolType: titleShapeType = "" } = null != titleShape ? titleShape : {}; if (isValid$1(titleValue) && "object" != typeof titleAttr.value.text) { @@ -124115,7 +124115,7 @@ var init_heatmap$2 = __esmMin((() => { } initCellBackgroundMarkStyle() { var _a, _b, _c; - const padding = normalizePadding(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); + const padding = normalizePadding$1(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); this.setMarkStyle(this._backgroundMark, { x: (datum) => { const width = this.getCellSize(this._xAxisHelper); @@ -130876,7 +130876,7 @@ function transformLabelAttributes(label, markerData, markAttributeContext) { return (null == shape ? void 0 : shape.visible) ? labelAttrs.shape = Object.assign({ visible: !0 }, transformToGraphic$1(shape.style)) : labelAttrs.shape = { visible: !1 }, !1 !== labelBackground.visible ? (labelAttrs.panel = Object.assign({ visible: !0, customShape: labelBackground.customShape - }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; + }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding$1(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; } return { visible: !1 }; } @@ -134695,7 +134695,7 @@ var init_style$5 = __esmMin((() => { let panelPadding = null; null != border && border.color && (panelStyle.borderColor = border.color), backgroundColor && (panelStyle.backgroundColor = backgroundColor), panelStyle.boxShadow = shadow ? `${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.spread}px ${shadow.color}` : "initial"; const { radius } = null != border ? border : {}; - return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { + return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding$1(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { panelStyle, panelPadding }; @@ -135019,7 +135019,7 @@ var init_attribute = __esmMin((() => { }; getTooltipAttributes = (actualTooltip, spec, globalFontFamily) => { var _a, _b, _c, _d, _e; - const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { + const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding$1(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { fill: !0, size: null !== (_a = null == shape ? void 0 : shape.size) && void 0 !== _a ? _a : 8, spacing: null !== (_b = null == shape ? void 0 : shape.spacing) && void 0 !== _b ? _b : 6 @@ -156416,7 +156416,7 @@ var init_scrollbar$1 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -156428,7 +156428,7 @@ var init_scrollbar$1 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -156647,7 +156647,7 @@ var init_tag$1 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -156882,7 +156882,7 @@ var init_poptip$1 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -163699,7 +163699,7 @@ var init_line$3 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -164004,7 +164004,7 @@ var init_line$3 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -164572,7 +164572,7 @@ var init_pager$1 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -164674,7 +164674,7 @@ var init_base$1 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -164691,7 +164691,7 @@ var init_base$1 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -164901,7 +164901,7 @@ var init_discrete = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator.group({ x: 0, @@ -166113,7 +166113,7 @@ var init_title$4 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -169074,7 +169074,65 @@ var init_color = __esmMin((() => { var init_type$1 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/padding.js -var init_padding$1 = __esmMin((() => {})); +function normalizePadding(padding) { + if (isValidNumber(padding)) return [ + padding, + padding, + padding, + padding + ]; + if (isArray$1(padding)) { + const length = padding.length; + if (1 === length) { + const paddingValue = padding[0]; + return [ + paddingValue, + paddingValue, + paddingValue, + paddingValue + ]; + } + if (2 === length) { + const [vertical, horizontal] = padding; + return [ + vertical, + horizontal, + vertical, + horizontal + ]; + } + if (3 === length) { + const [top, horizontal, bottom] = padding; + return [ + top, + horizontal, + bottom, + horizontal + ]; + } + if (4 === length) return padding; + } + if (isObject$9(padding)) { + const { top = 0, right = 0, bottom = 0, left = 0 } = padding; + return [ + top, + right, + bottom, + left + ]; + } + return [ + 0, + 0, + 0, + 0 + ]; +} +var init_padding$1 = __esmMin((() => { + init_isValidNumber(); + init_isArray(); + init_isObject(); +})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/time/formatUtils.js var init_formatUtils = __esmMin((() => {})); @@ -283933,4 +283991,4 @@ var init_mocker_runtime = __esmMin((() => { globalThis.__STORYBOOK_MOCKER__ = registerModuleMocker(() => new ModuleMockerInterceptor()); })); //#endregion -export { d$2 as $, init_Color as $t, init_yjs as A, H$2 as An, m$2 as At, date as B, preview_exports as Bn, PivotTableAll as Bt, init_kysely as C, isUndefined$1 as Cn, D$2 as Ct, YMap as D, init_esm$1 as Dn, i$5 as Dt, YArray as E, esm_default as En, r$3 as Et, _enum as F, h$3 as Fn, C$3 as Ft, number as G, init_chunk_6OBW3LSX as Gn, boxplot as Gt, init_schemas as H, init_entry_preview_docs as Hn, ListTableAll as Ht, any$1 as I, init_client as In, init_chunk_3GOCSNFN as It, string as J, init_entry_preview as Jn, init_bin as Jt, object as K, setCustomElementsManifest as Kn, init_boxplot as Kt, array as L, proxyCustomElement as Ln, init_es$1 as Lt, init_v4 as M, createEvent as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, forceUpdate as Nn, i$7 as Nt, applyUpdate as O, StreamLight$1 as On, init_chunk_2T7K3PFL as Ot, init_zod as P, getRenderingRef as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, setup as Qn, Color as Qt, boolean as R, transformTag as Rn, PivotChart as Rt, Kysely as S, init_isUndefined as Sn, y$2 as St, UndoManager as T, isNil as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_argtypes_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, entry_preview_docs_exports as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_argtypes as Wn, init_es$4 as Wt, union as X, init_preload_helper as Xn, init_register$1 as Xt, tuple as Y, __vitePreload as Yn, chartModule as Yt, require_tinycolor as Z, init_runtime as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, pickWithout as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, regressionPolynomial as an, init_chunk_BO3LQZNF as at, init_sql as b, init_isArray as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_logistic as cn, n$2 as ct, init_LikeFilled as d, regressionLinear as dn, e$1 as dt, ecdf as en, init_chunk_BCBB46UE as et, init_dist$2 as f, clamper as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, init_pickWithout as gn, t$1 as gt, init_postgres_adapter as h, init_array$1 as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_regression_polynomial as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, Host as jn, T$2 as jt, encodeStateAsUpdate as k, init_streamLight$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLogistic as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, array$2 as mn, n$3 as mt, init_mocker_runtime as n, init_kde as nn, k$2 as nt, SettingOutlined as o, init_regression_lowess as on, o$2 as ot, init_esm as p, init_clamper as pn, init_chunk_JK3VNB42 as pt, record as q, entry_preview_exports as qn, bin as qt, init_es as r, kde as rn, i$3 as rt, init_SettingOutlined as s, regressionLowess as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_ecdf as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_linear as un, o$3 as ut, DummyDriver as v, init_merge as vn, t$2 as vt, Doc as w, init_isNil as wn, init_chunk_PDQFB3TV as wt, sql as x, isArray$1 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, merge$2 as yn, i$4 as yt, custom as z, init_preview as zn, init_PivotChart as zt }; +export { d$2 as $, init_runtime as $n, normalizePadding as $t, init_yjs as A, StreamLight$1 as An, m$2 as At, date as B, transformTag as Bn, PivotTableAll as Bt, init_kysely as C, isArray$1 as Cn, D$2 as Ct, YMap as D, isNil as Dn, i$5 as Dt, YArray as E, init_isNil as En, r$3 as Et, _enum as F, forceUpdate as Fn, C$3 as Ft, number as G, entry_preview_argtypes_exports as Gn, boxplot as Gt, init_schemas as H, preview_exports as Hn, ListTableAll as Ht, any$1 as I, getRenderingRef as In, init_chunk_3GOCSNFN as It, string as J, setCustomElementsManifest as Jn, init_bin as Jt, object as K, init_entry_preview_argtypes as Kn, init_boxplot as Kt, array as L, h$3 as Ln, init_es$1 as Lt, init_v4 as M, H$2 as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, Host as Nn, i$7 as Nt, applyUpdate as O, esm_default as On, init_chunk_2T7K3PFL as Ot, init_zod as P, createEvent as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, init_preload_helper as Qn, init_padding$1 as Qt, boolean as R, init_client as Rn, PivotChart as Rt, Kysely as S, init_isArray as Sn, y$2 as St, UndoManager as T, isUndefined$1 as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_docs_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, init_preview as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_docs as Wn, init_es$4 as Wt, union as X, init_entry_preview as Xn, init_register$1 as Xt, tuple as Y, entry_preview_exports as Yn, chartModule as Yt, require_tinycolor as Z, __vitePreload as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, init_array$1 as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, kde as an, init_chunk_BO3LQZNF as at, init_sql as b, init_merge as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_lowess as cn, n$2 as ct, init_LikeFilled as d, regressionLogistic as dn, e$1 as dt, Color as en, setup as er, init_chunk_BCBB46UE as et, init_dist$2 as f, init_regression_linear as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, array$2 as gn, t$1 as gt, init_postgres_adapter as h, init_clamper as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_kde as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, init_streamLight$1 as jn, T$2 as jt, encodeStateAsUpdate as k, init_esm$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLowess as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, clamper as mn, n$3 as mt, init_mocker_runtime as n, ecdf as nn, k$2 as nt, SettingOutlined as o, init_regression_polynomial as on, o$2 as ot, init_esm as p, regressionLinear as pn, init_chunk_JK3VNB42 as pt, record as q, init_chunk_6OBW3LSX as qn, bin as qt, init_es as r, init_ecdf as rn, i$3 as rt, init_SettingOutlined as s, regressionPolynomial as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_Color as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_logistic as un, o$3 as ut, DummyDriver as v, init_pickWithout as vn, t$2 as vt, Doc as w, init_isUndefined as wn, init_chunk_PDQFB3TV as wt, sql as x, merge$2 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, pickWithout as yn, i$4 as yt, custom as z, proxyCustomElement as zn, init_PivotChart as zt }; diff --git a/apps/website/docs/public/storybook/en-US/assets/iframe.js b/apps/website/docs/public/storybook/en-US/assets/iframe.js index 5a7bb083aa..a84f4d6aec 100644 --- a/apps/website/docs/public/storybook/en-US/assets/iframe.js +++ b/apps/website/docs/public/storybook/en-US/assets/iframe.js @@ -1,5 +1,5 @@ import { n as __esmMin, o as __toESM, r as __exportAll } from "./rolldown-runtime.js"; -import { $ as d$6, A as init_yjs, An as H$4, At as m$8, B as date, Bn as preview_exports$1, Bt as PivotTableAll, Cn as isUndefined, Ct as D$4, D as YMap, Dn as init_esm$1, Dt as i$9, E as YArray, En as esm_default, Et as r$11, F as _enum, Fn as h$5, Ft as C$6, G as number, Gt as boxplot, Hn as init_entry_preview_docs, Ht as ListTableAll, I as any, In as init_client, J as string, Jn as init_entry_preview, K as object, Kn as setCustomElementsManifest, L as array$1, Ln as proxyCustomElement, Lt as init_es$2, Mn as createEvent, N as v4, Nn as forceUpdate, Nt as i$7, O as applyUpdate, On as StreamLight, P as init_zod, Pn as getRenderingRef, Q as init_dist$1, Qn as setup, Qt as Color, R as boolean, Rn as transformTag, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isNil, U as lazy, Un as entry_preview_argtypes_exports, V as discriminatedUnion, Vn as entry_preview_docs_exports, W as literal, Wn as init_entry_preview_argtypes, Wt as init_es$1, X as union, Xn as init_preload_helper, Y as tuple, Yn as __vitePreload, Yt as chartModule, Z as require_tinycolor, Zn as init_runtime, Zt as init_es, _n as pickWithout, an as regressionPolynomial, ct as n$11, dn as regressionLinear, dt as e$8, en as ecdf, f as init_dist$3, fn as clamper, g as PostgresQueryCompiler, gt as t$14, j as init_dist$2, jn as Host, jt as T$4, k as encodeStateAsUpdate, ln as regressionLogistic, m as PostgresAdapter, mn as array, mt as n$10, nt as k$7, ot as o$9, p as init_esm$2, q as record, qn as entry_preview_exports, qt as bin, rn as kde, rt as i$10, sn as regressionLowess, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as isArray, yn as merge, yt as i$8, z as custom, zn as init_preview$1 } from "./vendor.js"; +import { $ as d$6, $n as init_runtime, $t as normalizePadding, A as init_yjs, An as StreamLight, At as m$8, B as date, Bn as transformTag, Bt as PivotTableAll, Cn as isArray, Ct as D$4, D as YMap, Dn as isNil, Dt as i$9, E as YArray, Et as r$11, F as _enum, Fn as forceUpdate, Ft as C$6, G as number, Gn as entry_preview_argtypes_exports, Gt as boxplot, Hn as preview_exports$1, Ht as ListTableAll, I as any, In as getRenderingRef, J as string, Jn as setCustomElementsManifest, K as object, Kn as init_entry_preview_argtypes, L as array$1, Ln as h$5, Lt as init_es$2, Mn as H$4, N as v4, Nn as Host, Nt as i$7, O as applyUpdate, On as esm_default, P as init_zod, Pn as createEvent, Q as init_dist$1, Qn as init_preload_helper, R as boolean, Rn as init_client, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isUndefined, U as lazy, Un as entry_preview_docs_exports, V as discriminatedUnion, Vn as init_preview$1, W as literal, Wn as init_entry_preview_docs, Wt as init_es$1, X as union, Xn as init_entry_preview, Y as tuple, Yn as entry_preview_exports, Yt as chartModule, Z as require_tinycolor, Zn as __vitePreload, Zt as init_es, an as kde, ct as n$11, dn as regressionLogistic, dt as e$8, en as Color, er as setup, f as init_dist$3, g as PostgresQueryCompiler, gn as array, gt as t$14, j as init_dist$2, jt as T$4, k as encodeStateAsUpdate, kn as init_esm$1, ln as regressionLowess, m as PostgresAdapter, mn as clamper, mt as n$10, nn as ecdf, nt as k$7, ot as o$9, p as init_esm$2, pn as regressionLinear, q as record, qt as bin, rt as i$10, sn as regressionPolynomial, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as merge, yn as pickWithout, yt as i$8, z as custom, zn as proxyCustomElement } from "./vendor.js"; //#region iframe.html?html-proxy&inline-css&index=0.css var init_iframe_html_html_proxy_inline_css_index_0 = __esmMin((() => {})); //#endregion @@ -9397,6 +9397,195 @@ var init_stack$1 = __esmMin((() => { }; })); //#endregion +//#region ../vseed/dist/esm/dataSelector/selector.js +function nearlyEqual(a, b, epsilon = 1e-8) { + if (Number.isNaN(a) || Number.isNaN(b)) return false; + if (a === b) return true; + return Math.abs(a - b) <= epsilon; +} +var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; +var init_selector$1 = __esmMin((() => { + init_dist$1(); + init_sandbox(); + init_dataReshape(); + selector_selector = (vchartDatum, selector, selectorMode = "And") => { + if (!selector) return true; + const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); + return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { + if (isValueSelector(selector)) return selectByValue(selector, datum); + else if (isFieldSelector(selector)) return selectByField(selector, datum); + else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); + else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); + else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); + return false; + }); + }; + isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; + isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; + isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); + isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.operator) || [ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.op)); + isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); + selectByMeasure = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "=": + if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "==": + if (datum[selector.field] === selectorValueArr[0]) return true; + break; + case "!=": + if (datum[selector.field] !== selectorValueArr[0]) return true; + break; + case ">": + if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<": + if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case ">=": + if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<=": + if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "between": + if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; + break; + } + return false; + }; + selectByDmension = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "in": + if (selectorValueArr.includes(datum[selector.field])) return true; + break; + case "not in": + if (!selectorValueArr.includes(datum[selector.field])) return true; + break; + } + return false; + }; + selectByField = (selector, datum) => { + const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; + const datumKeys = Object.keys(datum); + return fields.some((field) => datumKeys.includes(field)); + }; + matchesFieldSelector = (field, fieldSelector) => { + return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); + }; + selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); + selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); + matchesCellSelector = (cell, filterRes) => { + if (filterRes["__row_index"] !== cell["__row_index"]) return false; + return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); + }; + matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); + isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; + isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); + isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); + isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); + validateFilterResult = (result, filter) => { + if (isValueDynamicFilter(filter)) { + if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); + return; + } + if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); + if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { + const item = result[i]; + if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); + if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); + if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); + } + }; + executeDynamicFilter = async (filter, allData) => { + try { + const { success, data, error } = await executeFilterCode({ + code: filter.code, + data: allData + }); + if (!success) { + console.warn("[vseed] Dynamic filter execution failed:", error); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error + }; + } + try { + validateFilterResult(data, filter); + } catch (validationError) { + console.error("[vseed] Dynamic filter result validation failed:", validationError); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: validationError instanceof Error ? validationError.message : String(validationError) + }; + } + return { + success, + data + }; + } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: errorMessage + }; + } + }; + matchDynamicFilterResult = (result, datum, selectorType = "table") => { + if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); + if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); + return result.some((item) => matchesDatum(datum, item)); + }; + selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { + if (!selectorConfig) return true; + if (isValueDynamicFilter(selectorConfig)) { + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + } + const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; + if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + }; +})); +//#endregion +//#region ../vseed/dist/esm/dataSelector/index.js +var init_dataSelector$1 = __esmMin((() => { + init_selector$1(); +})); +//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.js var reverseStackCornerRadius, mergeStackCornerRadius, getStackRangeCornerRadius, callbacks, createCornerRadius, createStackCornerRadius, createBarCornerRadius, hasMoveInAnimation; var init_stackCornerRadiusUtils = __esmMin((() => { @@ -9468,6 +9657,8 @@ var init_stackCornerRadiusUtils = __esmMin((() => { //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js var hasBarMoveInAnimation, stackCornerRadius_stackCornerRadius; var init_stackCornerRadius$2 = __esmMin((() => { + init_es(); + init_dataSelector$1(); init_stackCornerRadiusUtils(); hasBarMoveInAnimation = (spec) => [ spec.animationAppear, @@ -9478,13 +9669,23 @@ var init_stackCornerRadius$2 = __esmMin((() => { stackCornerRadius_stackCornerRadius = (spec, context) => { const { advancedVSeed, vseed } = context; const { chartType } = vseed; - const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius; - const styles = advancedVSeed.markStyle?.barStyle; - if (null == stackCornerRadius || (Array.isArray(styles) ? styles : styles ? [styles] : []).some((rule) => null != rule.barRadius)) return spec; - if (!(advancedVSeed.datasetReshapeInfo?.[0]?.unfoldInfo.colorItems.length === 1) && !hasBarMoveInAnimation(spec)) return { - ...spec, - stackCornerRadius: createStackCornerRadius(stackCornerRadius) - }; + const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius ?? 0; + if (!hasBarMoveInAnimation(spec)) { + const styles = advancedVSeed.markStyle?.barStyle; + const rules = (Array.isArray(styles) ? styles : styles ? [styles] : []).filter((rule) => null != rule.barRadius).reverse(); + const defaultRadius = createStackCornerRadius(stackCornerRadius); + const clipRadius = rules.length ? (attributes, datum) => { + const radius = defaultRadius(attributes, datum); + const rule = rules.find((rule) => rule.dynamicFilter ? selectorWithDynamicFilter(datum, rule.dynamicFilter, rule.selector) : selector_selector(datum, rule.selector)); + if (!rule) return radius; + const barRadius = normalizePadding(rule.barRadius); + return normalizePadding(radius).map((corner, index) => Math.min(corner, barRadius[index])); + } : defaultRadius; + return { + ...spec, + stackCornerRadius: clipRadius + }; + } return { ...spec, bar: { @@ -10492,195 +10693,6 @@ var init_tooltip$3 = __esmMin((() => { init_tooltipSankey(); })); //#endregion -//#region ../vseed/dist/esm/dataSelector/selector.js -function nearlyEqual(a, b, epsilon = 1e-8) { - if (Number.isNaN(a) || Number.isNaN(b)) return false; - if (a === b) return true; - return Math.abs(a - b) <= epsilon; -} -var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; -var init_selector$1 = __esmMin((() => { - init_dist$1(); - init_sandbox(); - init_dataReshape(); - selector_selector = (vchartDatum, selector, selectorMode = "And") => { - if (!selector) return true; - const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); - return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { - if (isValueSelector(selector)) return selectByValue(selector, datum); - else if (isFieldSelector(selector)) return selectByField(selector, datum); - else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); - else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); - else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); - return false; - }); - }; - isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; - isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; - isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); - isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.operator) || [ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.op)); - isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); - selectByMeasure = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "=": - if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "==": - if (datum[selector.field] === selectorValueArr[0]) return true; - break; - case "!=": - if (datum[selector.field] !== selectorValueArr[0]) return true; - break; - case ">": - if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<": - if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case ">=": - if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<=": - if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "between": - if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; - break; - } - return false; - }; - selectByDmension = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "in": - if (selectorValueArr.includes(datum[selector.field])) return true; - break; - case "not in": - if (!selectorValueArr.includes(datum[selector.field])) return true; - break; - } - return false; - }; - selectByField = (selector, datum) => { - const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; - const datumKeys = Object.keys(datum); - return fields.some((field) => datumKeys.includes(field)); - }; - matchesFieldSelector = (field, fieldSelector) => { - return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); - }; - selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); - selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); - matchesCellSelector = (cell, filterRes) => { - if (filterRes["__row_index"] !== cell["__row_index"]) return false; - return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); - }; - matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); - isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; - isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); - isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); - isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); - validateFilterResult = (result, filter) => { - if (isValueDynamicFilter(filter)) { - if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); - return; - } - if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); - if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { - const item = result[i]; - if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); - if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); - if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); - } - }; - executeDynamicFilter = async (filter, allData) => { - try { - const { success, data, error } = await executeFilterCode({ - code: filter.code, - data: allData - }); - if (!success) { - console.warn("[vseed] Dynamic filter execution failed:", error); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error - }; - } - try { - validateFilterResult(data, filter); - } catch (validationError) { - console.error("[vseed] Dynamic filter result validation failed:", validationError); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: validationError instanceof Error ? validationError.message : String(validationError) - }; - } - return { - success, - data - }; - } catch (error) { - const errorMessage = error instanceof Error ? error.message : String(error); - console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: errorMessage - }; - } - }; - matchDynamicFilterResult = (result, datum, selectorType = "table") => { - if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); - if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); - return result.some((item) => matchesDatum(datum, item)); - }; - selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { - if (!selectorConfig) return true; - if (isValueDynamicFilter(selectorConfig)) { - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - } - const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; - if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - }; -})); -//#endregion -//#region ../vseed/dist/esm/dataSelector/index.js -var init_dataSelector$1 = __esmMin((() => { - init_selector$1(); -})); -//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/label/label.js var label_label, generateMeasureValue, generateMeasurePercent, buildLabel$2; var init_label$3 = __esmMin((() => { diff --git a/apps/website/docs/public/storybook/en-US/assets/vendor.js b/apps/website/docs/public/storybook/en-US/assets/vendor.js index 173d315829..a2db127c02 100644 --- a/apps/website/docs/public/storybook/en-US/assets/vendor.js +++ b/apps/website/docs/public/storybook/en-US/assets/vendor.js @@ -50363,7 +50363,7 @@ var init_color$6 = __esmMin((() => { var init_type$70 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.24/node_modules/@visactor/vutils/es/padding.js -function normalizePadding(padding) { +function normalizePadding$1(padding) { if (isValidNumber$1(padding)) return [ padding, padding, @@ -97171,7 +97171,7 @@ var init_tag$3 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -98052,7 +98052,7 @@ var init_line$16 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis$1.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -98357,7 +98357,7 @@ var init_line$16 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize$1(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -101898,7 +101898,7 @@ var init_scrollbar$3 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -101910,7 +101910,7 @@ var init_scrollbar$3 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -102182,7 +102182,7 @@ var init_poptip$4 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -106455,7 +106455,7 @@ var init_pager$3 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE$1, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -106557,7 +106557,7 @@ var init_base$20 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator$1.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -106574,7 +106574,7 @@ var init_base$20 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -106790,7 +106790,7 @@ var init_discrete$4 = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator$1.group({ x: 0, @@ -108038,7 +108038,7 @@ var init_title$9 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -109310,7 +109310,7 @@ var init_tooltip$6 = __esmMin((() => { const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure, align } = this.attribute; if (!visible) return void this.hideAll(); autoMeasure && Tooltip$2.measureTooltip(this.attribute), autoCalculatePosition && Tooltip$2.calculateTooltipPosition(this.attribute); - const padding = normalizePadding(this.attribute.padding); + const padding = normalizePadding$1(this.attribute.padding); this._tooltipPanel = this.createOrUpdateChild("tooltip-background", Object.assign({ visible: !0 }, panel), "rect"), this._tooltipTitleContainer = this.createOrUpdateChild("tooltip-title", { visible: !0, x: padding[3], @@ -109405,7 +109405,7 @@ var init_tooltip$6 = __esmMin((() => { return "left" === positionX ? x -= tooltipBoxWidth + offsetX : "center" === positionX ? x -= tooltipBoxWidth / 2 : x += offsetX, "top" === positionY ? y -= tooltipBoxHeight + offsetY : "middle" === positionY ? y -= tooltipBoxHeight / 2 : y += offsetY, x + tooltipBoxWidth > parentBounds.x2 && (x -= tooltipBoxWidth + offsetX), y + tooltipBoxHeight > parentBounds.y2 && (y -= tooltipBoxHeight + offsetY), x < parentBounds.x1 && (x = parentBounds.x1), y < parentBounds.y1 && (y = parentBounds.y1), attribute.x = x, attribute.y = y, attribute; } static measureTooltip(attribute) { - const { content, contentStyle } = attribute, padding = normalizePadding(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); + const { content, contentStyle } = attribute, padding = normalizePadding$1(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); let maxWidth = 0, containerHeight = padding[0] + padding[2], titleMaxHeight = 0; const { value: titleValue, shape: titleShape } = titleAttr, { visible: titleHasShape = !1, symbolType: titleShapeType = "" } = null != titleShape ? titleShape : {}; if (isValid$1(titleValue) && "object" != typeof titleAttr.value.text) { @@ -124115,7 +124115,7 @@ var init_heatmap$2 = __esmMin((() => { } initCellBackgroundMarkStyle() { var _a, _b, _c; - const padding = normalizePadding(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); + const padding = normalizePadding$1(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); this.setMarkStyle(this._backgroundMark, { x: (datum) => { const width = this.getCellSize(this._xAxisHelper); @@ -130876,7 +130876,7 @@ function transformLabelAttributes(label, markerData, markAttributeContext) { return (null == shape ? void 0 : shape.visible) ? labelAttrs.shape = Object.assign({ visible: !0 }, transformToGraphic$1(shape.style)) : labelAttrs.shape = { visible: !1 }, !1 !== labelBackground.visible ? (labelAttrs.panel = Object.assign({ visible: !0, customShape: labelBackground.customShape - }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; + }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding$1(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; } return { visible: !1 }; } @@ -134695,7 +134695,7 @@ var init_style$5 = __esmMin((() => { let panelPadding = null; null != border && border.color && (panelStyle.borderColor = border.color), backgroundColor && (panelStyle.backgroundColor = backgroundColor), panelStyle.boxShadow = shadow ? `${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.spread}px ${shadow.color}` : "initial"; const { radius } = null != border ? border : {}; - return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { + return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding$1(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { panelStyle, panelPadding }; @@ -135019,7 +135019,7 @@ var init_attribute = __esmMin((() => { }; getTooltipAttributes = (actualTooltip, spec, globalFontFamily) => { var _a, _b, _c, _d, _e; - const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { + const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding$1(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { fill: !0, size: null !== (_a = null == shape ? void 0 : shape.size) && void 0 !== _a ? _a : 8, spacing: null !== (_b = null == shape ? void 0 : shape.spacing) && void 0 !== _b ? _b : 6 @@ -156416,7 +156416,7 @@ var init_scrollbar$1 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -156428,7 +156428,7 @@ var init_scrollbar$1 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -156647,7 +156647,7 @@ var init_tag$1 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -156882,7 +156882,7 @@ var init_poptip$1 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -163699,7 +163699,7 @@ var init_line$3 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -164004,7 +164004,7 @@ var init_line$3 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -164572,7 +164572,7 @@ var init_pager$1 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -164674,7 +164674,7 @@ var init_base$1 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -164691,7 +164691,7 @@ var init_base$1 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -164901,7 +164901,7 @@ var init_discrete = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator.group({ x: 0, @@ -166113,7 +166113,7 @@ var init_title$4 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -169074,7 +169074,65 @@ var init_color = __esmMin((() => { var init_type$1 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/padding.js -var init_padding$1 = __esmMin((() => {})); +function normalizePadding(padding) { + if (isValidNumber(padding)) return [ + padding, + padding, + padding, + padding + ]; + if (isArray$1(padding)) { + const length = padding.length; + if (1 === length) { + const paddingValue = padding[0]; + return [ + paddingValue, + paddingValue, + paddingValue, + paddingValue + ]; + } + if (2 === length) { + const [vertical, horizontal] = padding; + return [ + vertical, + horizontal, + vertical, + horizontal + ]; + } + if (3 === length) { + const [top, horizontal, bottom] = padding; + return [ + top, + horizontal, + bottom, + horizontal + ]; + } + if (4 === length) return padding; + } + if (isObject$9(padding)) { + const { top = 0, right = 0, bottom = 0, left = 0 } = padding; + return [ + top, + right, + bottom, + left + ]; + } + return [ + 0, + 0, + 0, + 0 + ]; +} +var init_padding$1 = __esmMin((() => { + init_isValidNumber(); + init_isArray(); + init_isObject(); +})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/time/formatUtils.js var init_formatUtils = __esmMin((() => {})); @@ -283933,4 +283991,4 @@ var init_mocker_runtime = __esmMin((() => { globalThis.__STORYBOOK_MOCKER__ = registerModuleMocker(() => new ModuleMockerInterceptor()); })); //#endregion -export { d$2 as $, init_Color as $t, init_yjs as A, H$2 as An, m$2 as At, date as B, preview_exports as Bn, PivotTableAll as Bt, init_kysely as C, isUndefined$1 as Cn, D$2 as Ct, YMap as D, init_esm$1 as Dn, i$5 as Dt, YArray as E, esm_default as En, r$3 as Et, _enum as F, h$3 as Fn, C$3 as Ft, number as G, init_chunk_6OBW3LSX as Gn, boxplot as Gt, init_schemas as H, init_entry_preview_docs as Hn, ListTableAll as Ht, any$1 as I, init_client as In, init_chunk_3GOCSNFN as It, string as J, init_entry_preview as Jn, init_bin as Jt, object as K, setCustomElementsManifest as Kn, init_boxplot as Kt, array as L, proxyCustomElement as Ln, init_es$1 as Lt, init_v4 as M, createEvent as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, forceUpdate as Nn, i$7 as Nt, applyUpdate as O, StreamLight$1 as On, init_chunk_2T7K3PFL as Ot, init_zod as P, getRenderingRef as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, setup as Qn, Color as Qt, boolean as R, transformTag as Rn, PivotChart as Rt, Kysely as S, init_isUndefined as Sn, y$2 as St, UndoManager as T, isNil as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_argtypes_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, entry_preview_docs_exports as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_argtypes as Wn, init_es$4 as Wt, union as X, init_preload_helper as Xn, init_register$1 as Xt, tuple as Y, __vitePreload as Yn, chartModule as Yt, require_tinycolor as Z, init_runtime as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, pickWithout as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, regressionPolynomial as an, init_chunk_BO3LQZNF as at, init_sql as b, init_isArray as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_logistic as cn, n$2 as ct, init_LikeFilled as d, regressionLinear as dn, e$1 as dt, ecdf as en, init_chunk_BCBB46UE as et, init_dist$2 as f, clamper as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, init_pickWithout as gn, t$1 as gt, init_postgres_adapter as h, init_array$1 as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_regression_polynomial as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, Host as jn, T$2 as jt, encodeStateAsUpdate as k, init_streamLight$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLogistic as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, array$2 as mn, n$3 as mt, init_mocker_runtime as n, init_kde as nn, k$2 as nt, SettingOutlined as o, init_regression_lowess as on, o$2 as ot, init_esm as p, init_clamper as pn, init_chunk_JK3VNB42 as pt, record as q, entry_preview_exports as qn, bin as qt, init_es as r, kde as rn, i$3 as rt, init_SettingOutlined as s, regressionLowess as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_ecdf as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_linear as un, o$3 as ut, DummyDriver as v, init_merge as vn, t$2 as vt, Doc as w, init_isNil as wn, init_chunk_PDQFB3TV as wt, sql as x, isArray$1 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, merge$2 as yn, i$4 as yt, custom as z, init_preview as zn, init_PivotChart as zt }; +export { d$2 as $, init_runtime as $n, normalizePadding as $t, init_yjs as A, StreamLight$1 as An, m$2 as At, date as B, transformTag as Bn, PivotTableAll as Bt, init_kysely as C, isArray$1 as Cn, D$2 as Ct, YMap as D, isNil as Dn, i$5 as Dt, YArray as E, init_isNil as En, r$3 as Et, _enum as F, forceUpdate as Fn, C$3 as Ft, number as G, entry_preview_argtypes_exports as Gn, boxplot as Gt, init_schemas as H, preview_exports as Hn, ListTableAll as Ht, any$1 as I, getRenderingRef as In, init_chunk_3GOCSNFN as It, string as J, setCustomElementsManifest as Jn, init_bin as Jt, object as K, init_entry_preview_argtypes as Kn, init_boxplot as Kt, array as L, h$3 as Ln, init_es$1 as Lt, init_v4 as M, H$2 as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, Host as Nn, i$7 as Nt, applyUpdate as O, esm_default as On, init_chunk_2T7K3PFL as Ot, init_zod as P, createEvent as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, init_preload_helper as Qn, init_padding$1 as Qt, boolean as R, init_client as Rn, PivotChart as Rt, Kysely as S, init_isArray as Sn, y$2 as St, UndoManager as T, isUndefined$1 as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_docs_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, init_preview as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_docs as Wn, init_es$4 as Wt, union as X, init_entry_preview as Xn, init_register$1 as Xt, tuple as Y, entry_preview_exports as Yn, chartModule as Yt, require_tinycolor as Z, __vitePreload as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, init_array$1 as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, kde as an, init_chunk_BO3LQZNF as at, init_sql as b, init_merge as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_lowess as cn, n$2 as ct, init_LikeFilled as d, regressionLogistic as dn, e$1 as dt, Color as en, setup as er, init_chunk_BCBB46UE as et, init_dist$2 as f, init_regression_linear as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, array$2 as gn, t$1 as gt, init_postgres_adapter as h, init_clamper as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_kde as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, init_streamLight$1 as jn, T$2 as jt, encodeStateAsUpdate as k, init_esm$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLowess as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, clamper as mn, n$3 as mt, init_mocker_runtime as n, ecdf as nn, k$2 as nt, SettingOutlined as o, init_regression_polynomial as on, o$2 as ot, init_esm as p, regressionLinear as pn, init_chunk_JK3VNB42 as pt, record as q, init_chunk_6OBW3LSX as qn, bin as qt, init_es as r, init_ecdf as rn, i$3 as rt, init_SettingOutlined as s, regressionPolynomial as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_Color as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_logistic as un, o$3 as ut, DummyDriver as v, init_pickWithout as vn, t$2 as vt, Doc as w, init_isUndefined as wn, init_chunk_PDQFB3TV as wt, sql as x, merge$2 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, pickWithout as yn, i$4 as yt, custom as z, proxyCustomElement as zn, init_PivotChart as zt }; diff --git a/apps/website/docs/public/storybook/fr-FR/assets/iframe.js b/apps/website/docs/public/storybook/fr-FR/assets/iframe.js index 9e5b11e2a0..d9ab67a91a 100644 --- a/apps/website/docs/public/storybook/fr-FR/assets/iframe.js +++ b/apps/website/docs/public/storybook/fr-FR/assets/iframe.js @@ -1,5 +1,5 @@ import { n as __esmMin, o as __toESM, r as __exportAll } from "./rolldown-runtime.js"; -import { $ as d$6, A as init_yjs, An as H$4, At as m$8, B as date, Bn as preview_exports$1, Bt as PivotTableAll, Cn as isUndefined, Ct as D$4, D as YMap, Dn as init_esm$1, Dt as i$9, E as YArray, En as esm_default, Et as r$11, F as _enum, Fn as h$5, Ft as C$6, G as number, Gt as boxplot, Hn as init_entry_preview_docs, Ht as ListTableAll, I as any, In as init_client, J as string, Jn as init_entry_preview, K as object, Kn as setCustomElementsManifest, L as array$1, Ln as proxyCustomElement, Lt as init_es$2, Mn as createEvent, N as v4, Nn as forceUpdate, Nt as i$7, O as applyUpdate, On as StreamLight, P as init_zod, Pn as getRenderingRef, Q as init_dist$1, Qn as setup, Qt as Color, R as boolean, Rn as transformTag, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isNil, U as lazy, Un as entry_preview_argtypes_exports, V as discriminatedUnion, Vn as entry_preview_docs_exports, W as literal, Wn as init_entry_preview_argtypes, Wt as init_es$1, X as union, Xn as init_preload_helper, Y as tuple, Yn as __vitePreload, Yt as chartModule, Z as require_tinycolor, Zn as init_runtime, Zt as init_es, _n as pickWithout, an as regressionPolynomial, ct as n$11, dn as regressionLinear, dt as e$8, en as ecdf, f as init_dist$3, fn as clamper, g as PostgresQueryCompiler, gt as t$14, j as init_dist$2, jn as Host, jt as T$4, k as encodeStateAsUpdate, ln as regressionLogistic, m as PostgresAdapter, mn as array, mt as n$10, nt as k$7, ot as o$9, p as init_esm$2, q as record, qn as entry_preview_exports, qt as bin, rn as kde, rt as i$10, sn as regressionLowess, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as isArray, yn as merge, yt as i$8, z as custom, zn as init_preview$1 } from "./vendor.js"; +import { $ as d$6, $n as init_runtime, $t as normalizePadding, A as init_yjs, An as StreamLight, At as m$8, B as date, Bn as transformTag, Bt as PivotTableAll, Cn as isArray, Ct as D$4, D as YMap, Dn as isNil, Dt as i$9, E as YArray, Et as r$11, F as _enum, Fn as forceUpdate, Ft as C$6, G as number, Gn as entry_preview_argtypes_exports, Gt as boxplot, Hn as preview_exports$1, Ht as ListTableAll, I as any, In as getRenderingRef, J as string, Jn as setCustomElementsManifest, K as object, Kn as init_entry_preview_argtypes, L as array$1, Ln as h$5, Lt as init_es$2, Mn as H$4, N as v4, Nn as Host, Nt as i$7, O as applyUpdate, On as esm_default, P as init_zod, Pn as createEvent, Q as init_dist$1, Qn as init_preload_helper, R as boolean, Rn as init_client, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isUndefined, U as lazy, Un as entry_preview_docs_exports, V as discriminatedUnion, Vn as init_preview$1, W as literal, Wn as init_entry_preview_docs, Wt as init_es$1, X as union, Xn as init_entry_preview, Y as tuple, Yn as entry_preview_exports, Yt as chartModule, Z as require_tinycolor, Zn as __vitePreload, Zt as init_es, an as kde, ct as n$11, dn as regressionLogistic, dt as e$8, en as Color, er as setup, f as init_dist$3, g as PostgresQueryCompiler, gn as array, gt as t$14, j as init_dist$2, jt as T$4, k as encodeStateAsUpdate, kn as init_esm$1, ln as regressionLowess, m as PostgresAdapter, mn as clamper, mt as n$10, nn as ecdf, nt as k$7, ot as o$9, p as init_esm$2, pn as regressionLinear, q as record, qt as bin, rt as i$10, sn as regressionPolynomial, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as merge, yn as pickWithout, yt as i$8, z as custom, zn as proxyCustomElement } from "./vendor.js"; //#region iframe.html?html-proxy&inline-css&index=0.css var init_iframe_html_html_proxy_inline_css_index_0 = __esmMin((() => {})); //#endregion @@ -9397,6 +9397,195 @@ var init_stack$1 = __esmMin((() => { }; })); //#endregion +//#region ../vseed/dist/esm/dataSelector/selector.js +function nearlyEqual(a, b, epsilon = 1e-8) { + if (Number.isNaN(a) || Number.isNaN(b)) return false; + if (a === b) return true; + return Math.abs(a - b) <= epsilon; +} +var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; +var init_selector$1 = __esmMin((() => { + init_dist$1(); + init_sandbox(); + init_dataReshape(); + selector_selector = (vchartDatum, selector, selectorMode = "And") => { + if (!selector) return true; + const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); + return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { + if (isValueSelector(selector)) return selectByValue(selector, datum); + else if (isFieldSelector(selector)) return selectByField(selector, datum); + else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); + else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); + else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); + return false; + }); + }; + isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; + isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; + isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); + isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.operator) || [ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.op)); + isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); + selectByMeasure = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "=": + if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "==": + if (datum[selector.field] === selectorValueArr[0]) return true; + break; + case "!=": + if (datum[selector.field] !== selectorValueArr[0]) return true; + break; + case ">": + if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<": + if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case ">=": + if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<=": + if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "between": + if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; + break; + } + return false; + }; + selectByDmension = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "in": + if (selectorValueArr.includes(datum[selector.field])) return true; + break; + case "not in": + if (!selectorValueArr.includes(datum[selector.field])) return true; + break; + } + return false; + }; + selectByField = (selector, datum) => { + const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; + const datumKeys = Object.keys(datum); + return fields.some((field) => datumKeys.includes(field)); + }; + matchesFieldSelector = (field, fieldSelector) => { + return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); + }; + selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); + selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); + matchesCellSelector = (cell, filterRes) => { + if (filterRes["__row_index"] !== cell["__row_index"]) return false; + return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); + }; + matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); + isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; + isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); + isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); + isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); + validateFilterResult = (result, filter) => { + if (isValueDynamicFilter(filter)) { + if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); + return; + } + if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); + if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { + const item = result[i]; + if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); + if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); + if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); + } + }; + executeDynamicFilter = async (filter, allData) => { + try { + const { success, data, error } = await executeFilterCode({ + code: filter.code, + data: allData + }); + if (!success) { + console.warn("[vseed] Dynamic filter execution failed:", error); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error + }; + } + try { + validateFilterResult(data, filter); + } catch (validationError) { + console.error("[vseed] Dynamic filter result validation failed:", validationError); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: validationError instanceof Error ? validationError.message : String(validationError) + }; + } + return { + success, + data + }; + } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: errorMessage + }; + } + }; + matchDynamicFilterResult = (result, datum, selectorType = "table") => { + if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); + if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); + return result.some((item) => matchesDatum(datum, item)); + }; + selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { + if (!selectorConfig) return true; + if (isValueDynamicFilter(selectorConfig)) { + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + } + const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; + if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + }; +})); +//#endregion +//#region ../vseed/dist/esm/dataSelector/index.js +var init_dataSelector$1 = __esmMin((() => { + init_selector$1(); +})); +//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.js var reverseStackCornerRadius, mergeStackCornerRadius, getStackRangeCornerRadius, callbacks, createCornerRadius, createStackCornerRadius, createBarCornerRadius, hasMoveInAnimation; var init_stackCornerRadiusUtils = __esmMin((() => { @@ -9468,6 +9657,8 @@ var init_stackCornerRadiusUtils = __esmMin((() => { //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js var hasBarMoveInAnimation, stackCornerRadius_stackCornerRadius; var init_stackCornerRadius$2 = __esmMin((() => { + init_es(); + init_dataSelector$1(); init_stackCornerRadiusUtils(); hasBarMoveInAnimation = (spec) => [ spec.animationAppear, @@ -9478,13 +9669,23 @@ var init_stackCornerRadius$2 = __esmMin((() => { stackCornerRadius_stackCornerRadius = (spec, context) => { const { advancedVSeed, vseed } = context; const { chartType } = vseed; - const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius; - const styles = advancedVSeed.markStyle?.barStyle; - if (null == stackCornerRadius || (Array.isArray(styles) ? styles : styles ? [styles] : []).some((rule) => null != rule.barRadius)) return spec; - if (!(advancedVSeed.datasetReshapeInfo?.[0]?.unfoldInfo.colorItems.length === 1) && !hasBarMoveInAnimation(spec)) return { - ...spec, - stackCornerRadius: createStackCornerRadius(stackCornerRadius) - }; + const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius ?? 0; + if (!hasBarMoveInAnimation(spec)) { + const styles = advancedVSeed.markStyle?.barStyle; + const rules = (Array.isArray(styles) ? styles : styles ? [styles] : []).filter((rule) => null != rule.barRadius).reverse(); + const defaultRadius = createStackCornerRadius(stackCornerRadius); + const clipRadius = rules.length ? (attributes, datum) => { + const radius = defaultRadius(attributes, datum); + const rule = rules.find((rule) => rule.dynamicFilter ? selectorWithDynamicFilter(datum, rule.dynamicFilter, rule.selector) : selector_selector(datum, rule.selector)); + if (!rule) return radius; + const barRadius = normalizePadding(rule.barRadius); + return normalizePadding(radius).map((corner, index) => Math.min(corner, barRadius[index])); + } : defaultRadius; + return { + ...spec, + stackCornerRadius: clipRadius + }; + } return { ...spec, bar: { @@ -10492,195 +10693,6 @@ var init_tooltip$3 = __esmMin((() => { init_tooltipSankey(); })); //#endregion -//#region ../vseed/dist/esm/dataSelector/selector.js -function nearlyEqual(a, b, epsilon = 1e-8) { - if (Number.isNaN(a) || Number.isNaN(b)) return false; - if (a === b) return true; - return Math.abs(a - b) <= epsilon; -} -var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; -var init_selector$1 = __esmMin((() => { - init_dist$1(); - init_sandbox(); - init_dataReshape(); - selector_selector = (vchartDatum, selector, selectorMode = "And") => { - if (!selector) return true; - const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); - return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { - if (isValueSelector(selector)) return selectByValue(selector, datum); - else if (isFieldSelector(selector)) return selectByField(selector, datum); - else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); - else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); - else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); - return false; - }); - }; - isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; - isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; - isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); - isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.operator) || [ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.op)); - isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); - selectByMeasure = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "=": - if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "==": - if (datum[selector.field] === selectorValueArr[0]) return true; - break; - case "!=": - if (datum[selector.field] !== selectorValueArr[0]) return true; - break; - case ">": - if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<": - if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case ">=": - if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<=": - if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "between": - if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; - break; - } - return false; - }; - selectByDmension = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "in": - if (selectorValueArr.includes(datum[selector.field])) return true; - break; - case "not in": - if (!selectorValueArr.includes(datum[selector.field])) return true; - break; - } - return false; - }; - selectByField = (selector, datum) => { - const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; - const datumKeys = Object.keys(datum); - return fields.some((field) => datumKeys.includes(field)); - }; - matchesFieldSelector = (field, fieldSelector) => { - return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); - }; - selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); - selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); - matchesCellSelector = (cell, filterRes) => { - if (filterRes["__row_index"] !== cell["__row_index"]) return false; - return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); - }; - matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); - isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; - isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); - isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); - isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); - validateFilterResult = (result, filter) => { - if (isValueDynamicFilter(filter)) { - if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); - return; - } - if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); - if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { - const item = result[i]; - if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); - if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); - if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); - } - }; - executeDynamicFilter = async (filter, allData) => { - try { - const { success, data, error } = await executeFilterCode({ - code: filter.code, - data: allData - }); - if (!success) { - console.warn("[vseed] Dynamic filter execution failed:", error); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error - }; - } - try { - validateFilterResult(data, filter); - } catch (validationError) { - console.error("[vseed] Dynamic filter result validation failed:", validationError); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: validationError instanceof Error ? validationError.message : String(validationError) - }; - } - return { - success, - data - }; - } catch (error) { - const errorMessage = error instanceof Error ? error.message : String(error); - console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: errorMessage - }; - } - }; - matchDynamicFilterResult = (result, datum, selectorType = "table") => { - if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); - if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); - return result.some((item) => matchesDatum(datum, item)); - }; - selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { - if (!selectorConfig) return true; - if (isValueDynamicFilter(selectorConfig)) { - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - } - const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; - if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - }; -})); -//#endregion -//#region ../vseed/dist/esm/dataSelector/index.js -var init_dataSelector$1 = __esmMin((() => { - init_selector$1(); -})); -//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/label/label.js var label_label, generateMeasureValue, generateMeasurePercent, buildLabel$2; var init_label$3 = __esmMin((() => { diff --git a/apps/website/docs/public/storybook/fr-FR/assets/vendor.js b/apps/website/docs/public/storybook/fr-FR/assets/vendor.js index 173d315829..a2db127c02 100644 --- a/apps/website/docs/public/storybook/fr-FR/assets/vendor.js +++ b/apps/website/docs/public/storybook/fr-FR/assets/vendor.js @@ -50363,7 +50363,7 @@ var init_color$6 = __esmMin((() => { var init_type$70 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.24/node_modules/@visactor/vutils/es/padding.js -function normalizePadding(padding) { +function normalizePadding$1(padding) { if (isValidNumber$1(padding)) return [ padding, padding, @@ -97171,7 +97171,7 @@ var init_tag$3 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -98052,7 +98052,7 @@ var init_line$16 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis$1.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -98357,7 +98357,7 @@ var init_line$16 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize$1(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -101898,7 +101898,7 @@ var init_scrollbar$3 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -101910,7 +101910,7 @@ var init_scrollbar$3 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -102182,7 +102182,7 @@ var init_poptip$4 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -106455,7 +106455,7 @@ var init_pager$3 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE$1, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -106557,7 +106557,7 @@ var init_base$20 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator$1.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -106574,7 +106574,7 @@ var init_base$20 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -106790,7 +106790,7 @@ var init_discrete$4 = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator$1.group({ x: 0, @@ -108038,7 +108038,7 @@ var init_title$9 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -109310,7 +109310,7 @@ var init_tooltip$6 = __esmMin((() => { const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure, align } = this.attribute; if (!visible) return void this.hideAll(); autoMeasure && Tooltip$2.measureTooltip(this.attribute), autoCalculatePosition && Tooltip$2.calculateTooltipPosition(this.attribute); - const padding = normalizePadding(this.attribute.padding); + const padding = normalizePadding$1(this.attribute.padding); this._tooltipPanel = this.createOrUpdateChild("tooltip-background", Object.assign({ visible: !0 }, panel), "rect"), this._tooltipTitleContainer = this.createOrUpdateChild("tooltip-title", { visible: !0, x: padding[3], @@ -109405,7 +109405,7 @@ var init_tooltip$6 = __esmMin((() => { return "left" === positionX ? x -= tooltipBoxWidth + offsetX : "center" === positionX ? x -= tooltipBoxWidth / 2 : x += offsetX, "top" === positionY ? y -= tooltipBoxHeight + offsetY : "middle" === positionY ? y -= tooltipBoxHeight / 2 : y += offsetY, x + tooltipBoxWidth > parentBounds.x2 && (x -= tooltipBoxWidth + offsetX), y + tooltipBoxHeight > parentBounds.y2 && (y -= tooltipBoxHeight + offsetY), x < parentBounds.x1 && (x = parentBounds.x1), y < parentBounds.y1 && (y = parentBounds.y1), attribute.x = x, attribute.y = y, attribute; } static measureTooltip(attribute) { - const { content, contentStyle } = attribute, padding = normalizePadding(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); + const { content, contentStyle } = attribute, padding = normalizePadding$1(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); let maxWidth = 0, containerHeight = padding[0] + padding[2], titleMaxHeight = 0; const { value: titleValue, shape: titleShape } = titleAttr, { visible: titleHasShape = !1, symbolType: titleShapeType = "" } = null != titleShape ? titleShape : {}; if (isValid$1(titleValue) && "object" != typeof titleAttr.value.text) { @@ -124115,7 +124115,7 @@ var init_heatmap$2 = __esmMin((() => { } initCellBackgroundMarkStyle() { var _a, _b, _c; - const padding = normalizePadding(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); + const padding = normalizePadding$1(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); this.setMarkStyle(this._backgroundMark, { x: (datum) => { const width = this.getCellSize(this._xAxisHelper); @@ -130876,7 +130876,7 @@ function transformLabelAttributes(label, markerData, markAttributeContext) { return (null == shape ? void 0 : shape.visible) ? labelAttrs.shape = Object.assign({ visible: !0 }, transformToGraphic$1(shape.style)) : labelAttrs.shape = { visible: !1 }, !1 !== labelBackground.visible ? (labelAttrs.panel = Object.assign({ visible: !0, customShape: labelBackground.customShape - }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; + }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding$1(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; } return { visible: !1 }; } @@ -134695,7 +134695,7 @@ var init_style$5 = __esmMin((() => { let panelPadding = null; null != border && border.color && (panelStyle.borderColor = border.color), backgroundColor && (panelStyle.backgroundColor = backgroundColor), panelStyle.boxShadow = shadow ? `${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.spread}px ${shadow.color}` : "initial"; const { radius } = null != border ? border : {}; - return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { + return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding$1(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { panelStyle, panelPadding }; @@ -135019,7 +135019,7 @@ var init_attribute = __esmMin((() => { }; getTooltipAttributes = (actualTooltip, spec, globalFontFamily) => { var _a, _b, _c, _d, _e; - const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { + const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding$1(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { fill: !0, size: null !== (_a = null == shape ? void 0 : shape.size) && void 0 !== _a ? _a : 8, spacing: null !== (_b = null == shape ? void 0 : shape.spacing) && void 0 !== _b ? _b : 6 @@ -156416,7 +156416,7 @@ var init_scrollbar$1 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -156428,7 +156428,7 @@ var init_scrollbar$1 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -156647,7 +156647,7 @@ var init_tag$1 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -156882,7 +156882,7 @@ var init_poptip$1 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -163699,7 +163699,7 @@ var init_line$3 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -164004,7 +164004,7 @@ var init_line$3 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -164572,7 +164572,7 @@ var init_pager$1 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -164674,7 +164674,7 @@ var init_base$1 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -164691,7 +164691,7 @@ var init_base$1 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -164901,7 +164901,7 @@ var init_discrete = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator.group({ x: 0, @@ -166113,7 +166113,7 @@ var init_title$4 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -169074,7 +169074,65 @@ var init_color = __esmMin((() => { var init_type$1 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/padding.js -var init_padding$1 = __esmMin((() => {})); +function normalizePadding(padding) { + if (isValidNumber(padding)) return [ + padding, + padding, + padding, + padding + ]; + if (isArray$1(padding)) { + const length = padding.length; + if (1 === length) { + const paddingValue = padding[0]; + return [ + paddingValue, + paddingValue, + paddingValue, + paddingValue + ]; + } + if (2 === length) { + const [vertical, horizontal] = padding; + return [ + vertical, + horizontal, + vertical, + horizontal + ]; + } + if (3 === length) { + const [top, horizontal, bottom] = padding; + return [ + top, + horizontal, + bottom, + horizontal + ]; + } + if (4 === length) return padding; + } + if (isObject$9(padding)) { + const { top = 0, right = 0, bottom = 0, left = 0 } = padding; + return [ + top, + right, + bottom, + left + ]; + } + return [ + 0, + 0, + 0, + 0 + ]; +} +var init_padding$1 = __esmMin((() => { + init_isValidNumber(); + init_isArray(); + init_isObject(); +})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/time/formatUtils.js var init_formatUtils = __esmMin((() => {})); @@ -283933,4 +283991,4 @@ var init_mocker_runtime = __esmMin((() => { globalThis.__STORYBOOK_MOCKER__ = registerModuleMocker(() => new ModuleMockerInterceptor()); })); //#endregion -export { d$2 as $, init_Color as $t, init_yjs as A, H$2 as An, m$2 as At, date as B, preview_exports as Bn, PivotTableAll as Bt, init_kysely as C, isUndefined$1 as Cn, D$2 as Ct, YMap as D, init_esm$1 as Dn, i$5 as Dt, YArray as E, esm_default as En, r$3 as Et, _enum as F, h$3 as Fn, C$3 as Ft, number as G, init_chunk_6OBW3LSX as Gn, boxplot as Gt, init_schemas as H, init_entry_preview_docs as Hn, ListTableAll as Ht, any$1 as I, init_client as In, init_chunk_3GOCSNFN as It, string as J, init_entry_preview as Jn, init_bin as Jt, object as K, setCustomElementsManifest as Kn, init_boxplot as Kt, array as L, proxyCustomElement as Ln, init_es$1 as Lt, init_v4 as M, createEvent as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, forceUpdate as Nn, i$7 as Nt, applyUpdate as O, StreamLight$1 as On, init_chunk_2T7K3PFL as Ot, init_zod as P, getRenderingRef as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, setup as Qn, Color as Qt, boolean as R, transformTag as Rn, PivotChart as Rt, Kysely as S, init_isUndefined as Sn, y$2 as St, UndoManager as T, isNil as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_argtypes_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, entry_preview_docs_exports as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_argtypes as Wn, init_es$4 as Wt, union as X, init_preload_helper as Xn, init_register$1 as Xt, tuple as Y, __vitePreload as Yn, chartModule as Yt, require_tinycolor as Z, init_runtime as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, pickWithout as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, regressionPolynomial as an, init_chunk_BO3LQZNF as at, init_sql as b, init_isArray as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_logistic as cn, n$2 as ct, init_LikeFilled as d, regressionLinear as dn, e$1 as dt, ecdf as en, init_chunk_BCBB46UE as et, init_dist$2 as f, clamper as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, init_pickWithout as gn, t$1 as gt, init_postgres_adapter as h, init_array$1 as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_regression_polynomial as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, Host as jn, T$2 as jt, encodeStateAsUpdate as k, init_streamLight$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLogistic as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, array$2 as mn, n$3 as mt, init_mocker_runtime as n, init_kde as nn, k$2 as nt, SettingOutlined as o, init_regression_lowess as on, o$2 as ot, init_esm as p, init_clamper as pn, init_chunk_JK3VNB42 as pt, record as q, entry_preview_exports as qn, bin as qt, init_es as r, kde as rn, i$3 as rt, init_SettingOutlined as s, regressionLowess as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_ecdf as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_linear as un, o$3 as ut, DummyDriver as v, init_merge as vn, t$2 as vt, Doc as w, init_isNil as wn, init_chunk_PDQFB3TV as wt, sql as x, isArray$1 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, merge$2 as yn, i$4 as yt, custom as z, init_preview as zn, init_PivotChart as zt }; +export { d$2 as $, init_runtime as $n, normalizePadding as $t, init_yjs as A, StreamLight$1 as An, m$2 as At, date as B, transformTag as Bn, PivotTableAll as Bt, init_kysely as C, isArray$1 as Cn, D$2 as Ct, YMap as D, isNil as Dn, i$5 as Dt, YArray as E, init_isNil as En, r$3 as Et, _enum as F, forceUpdate as Fn, C$3 as Ft, number as G, entry_preview_argtypes_exports as Gn, boxplot as Gt, init_schemas as H, preview_exports as Hn, ListTableAll as Ht, any$1 as I, getRenderingRef as In, init_chunk_3GOCSNFN as It, string as J, setCustomElementsManifest as Jn, init_bin as Jt, object as K, init_entry_preview_argtypes as Kn, init_boxplot as Kt, array as L, h$3 as Ln, init_es$1 as Lt, init_v4 as M, H$2 as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, Host as Nn, i$7 as Nt, applyUpdate as O, esm_default as On, init_chunk_2T7K3PFL as Ot, init_zod as P, createEvent as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, init_preload_helper as Qn, init_padding$1 as Qt, boolean as R, init_client as Rn, PivotChart as Rt, Kysely as S, init_isArray as Sn, y$2 as St, UndoManager as T, isUndefined$1 as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_docs_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, init_preview as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_docs as Wn, init_es$4 as Wt, union as X, init_entry_preview as Xn, init_register$1 as Xt, tuple as Y, entry_preview_exports as Yn, chartModule as Yt, require_tinycolor as Z, __vitePreload as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, init_array$1 as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, kde as an, init_chunk_BO3LQZNF as at, init_sql as b, init_merge as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_lowess as cn, n$2 as ct, init_LikeFilled as d, regressionLogistic as dn, e$1 as dt, Color as en, setup as er, init_chunk_BCBB46UE as et, init_dist$2 as f, init_regression_linear as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, array$2 as gn, t$1 as gt, init_postgres_adapter as h, init_clamper as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_kde as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, init_streamLight$1 as jn, T$2 as jt, encodeStateAsUpdate as k, init_esm$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLowess as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, clamper as mn, n$3 as mt, init_mocker_runtime as n, ecdf as nn, k$2 as nt, SettingOutlined as o, init_regression_polynomial as on, o$2 as ot, init_esm as p, regressionLinear as pn, init_chunk_JK3VNB42 as pt, record as q, init_chunk_6OBW3LSX as qn, bin as qt, init_es as r, init_ecdf as rn, i$3 as rt, init_SettingOutlined as s, regressionPolynomial as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_Color as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_logistic as un, o$3 as ut, DummyDriver as v, init_pickWithout as vn, t$2 as vt, Doc as w, init_isUndefined as wn, init_chunk_PDQFB3TV as wt, sql as x, merge$2 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, pickWithout as yn, i$4 as yt, custom as z, proxyCustomElement as zn, init_PivotChart as zt }; diff --git a/apps/website/docs/public/storybook/id-ID/assets/iframe.js b/apps/website/docs/public/storybook/id-ID/assets/iframe.js index 383f7e0bdd..eedf0d0953 100644 --- a/apps/website/docs/public/storybook/id-ID/assets/iframe.js +++ b/apps/website/docs/public/storybook/id-ID/assets/iframe.js @@ -1,5 +1,5 @@ import { n as __esmMin, o as __toESM, r as __exportAll } from "./rolldown-runtime.js"; -import { $ as d$6, A as init_yjs, An as H$4, At as m$8, B as date, Bn as preview_exports$1, Bt as PivotTableAll, Cn as isUndefined, Ct as D$4, D as YMap, Dn as init_esm$1, Dt as i$9, E as YArray, En as esm_default, Et as r$11, F as _enum, Fn as h$5, Ft as C$6, G as number, Gt as boxplot, Hn as init_entry_preview_docs, Ht as ListTableAll, I as any, In as init_client, J as string, Jn as init_entry_preview, K as object, Kn as setCustomElementsManifest, L as array$1, Ln as proxyCustomElement, Lt as init_es$2, Mn as createEvent, N as v4, Nn as forceUpdate, Nt as i$7, O as applyUpdate, On as StreamLight, P as init_zod, Pn as getRenderingRef, Q as init_dist$1, Qn as setup, Qt as Color, R as boolean, Rn as transformTag, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isNil, U as lazy, Un as entry_preview_argtypes_exports, V as discriminatedUnion, Vn as entry_preview_docs_exports, W as literal, Wn as init_entry_preview_argtypes, Wt as init_es$1, X as union, Xn as init_preload_helper, Y as tuple, Yn as __vitePreload, Yt as chartModule, Z as require_tinycolor, Zn as init_runtime, Zt as init_es, _n as pickWithout, an as regressionPolynomial, ct as n$11, dn as regressionLinear, dt as e$8, en as ecdf, f as init_dist$3, fn as clamper, g as PostgresQueryCompiler, gt as t$14, j as init_dist$2, jn as Host, jt as T$4, k as encodeStateAsUpdate, ln as regressionLogistic, m as PostgresAdapter, mn as array, mt as n$10, nt as k$7, ot as o$9, p as init_esm$2, q as record, qn as entry_preview_exports, qt as bin, rn as kde, rt as i$10, sn as regressionLowess, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as isArray, yn as merge, yt as i$8, z as custom, zn as init_preview$1 } from "./vendor.js"; +import { $ as d$6, $n as init_runtime, $t as normalizePadding, A as init_yjs, An as StreamLight, At as m$8, B as date, Bn as transformTag, Bt as PivotTableAll, Cn as isArray, Ct as D$4, D as YMap, Dn as isNil, Dt as i$9, E as YArray, Et as r$11, F as _enum, Fn as forceUpdate, Ft as C$6, G as number, Gn as entry_preview_argtypes_exports, Gt as boxplot, Hn as preview_exports$1, Ht as ListTableAll, I as any, In as getRenderingRef, J as string, Jn as setCustomElementsManifest, K as object, Kn as init_entry_preview_argtypes, L as array$1, Ln as h$5, Lt as init_es$2, Mn as H$4, N as v4, Nn as Host, Nt as i$7, O as applyUpdate, On as esm_default, P as init_zod, Pn as createEvent, Q as init_dist$1, Qn as init_preload_helper, R as boolean, Rn as init_client, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isUndefined, U as lazy, Un as entry_preview_docs_exports, V as discriminatedUnion, Vn as init_preview$1, W as literal, Wn as init_entry_preview_docs, Wt as init_es$1, X as union, Xn as init_entry_preview, Y as tuple, Yn as entry_preview_exports, Yt as chartModule, Z as require_tinycolor, Zn as __vitePreload, Zt as init_es, an as kde, ct as n$11, dn as regressionLogistic, dt as e$8, en as Color, er as setup, f as init_dist$3, g as PostgresQueryCompiler, gn as array, gt as t$14, j as init_dist$2, jt as T$4, k as encodeStateAsUpdate, kn as init_esm$1, ln as regressionLowess, m as PostgresAdapter, mn as clamper, mt as n$10, nn as ecdf, nt as k$7, ot as o$9, p as init_esm$2, pn as regressionLinear, q as record, qt as bin, rt as i$10, sn as regressionPolynomial, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as merge, yn as pickWithout, yt as i$8, z as custom, zn as proxyCustomElement } from "./vendor.js"; //#region iframe.html?html-proxy&inline-css&index=0.css var init_iframe_html_html_proxy_inline_css_index_0 = __esmMin((() => {})); //#endregion @@ -9397,6 +9397,195 @@ var init_stack$1 = __esmMin((() => { }; })); //#endregion +//#region ../vseed/dist/esm/dataSelector/selector.js +function nearlyEqual(a, b, epsilon = 1e-8) { + if (Number.isNaN(a) || Number.isNaN(b)) return false; + if (a === b) return true; + return Math.abs(a - b) <= epsilon; +} +var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; +var init_selector$1 = __esmMin((() => { + init_dist$1(); + init_sandbox(); + init_dataReshape(); + selector_selector = (vchartDatum, selector, selectorMode = "And") => { + if (!selector) return true; + const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); + return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { + if (isValueSelector(selector)) return selectByValue(selector, datum); + else if (isFieldSelector(selector)) return selectByField(selector, datum); + else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); + else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); + else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); + return false; + }); + }; + isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; + isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; + isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); + isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.operator) || [ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.op)); + isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); + selectByMeasure = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "=": + if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "==": + if (datum[selector.field] === selectorValueArr[0]) return true; + break; + case "!=": + if (datum[selector.field] !== selectorValueArr[0]) return true; + break; + case ">": + if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<": + if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case ">=": + if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<=": + if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "between": + if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; + break; + } + return false; + }; + selectByDmension = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "in": + if (selectorValueArr.includes(datum[selector.field])) return true; + break; + case "not in": + if (!selectorValueArr.includes(datum[selector.field])) return true; + break; + } + return false; + }; + selectByField = (selector, datum) => { + const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; + const datumKeys = Object.keys(datum); + return fields.some((field) => datumKeys.includes(field)); + }; + matchesFieldSelector = (field, fieldSelector) => { + return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); + }; + selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); + selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); + matchesCellSelector = (cell, filterRes) => { + if (filterRes["__row_index"] !== cell["__row_index"]) return false; + return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); + }; + matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); + isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; + isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); + isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); + isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); + validateFilterResult = (result, filter) => { + if (isValueDynamicFilter(filter)) { + if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); + return; + } + if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); + if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { + const item = result[i]; + if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); + if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); + if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); + } + }; + executeDynamicFilter = async (filter, allData) => { + try { + const { success, data, error } = await executeFilterCode({ + code: filter.code, + data: allData + }); + if (!success) { + console.warn("[vseed] Dynamic filter execution failed:", error); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error + }; + } + try { + validateFilterResult(data, filter); + } catch (validationError) { + console.error("[vseed] Dynamic filter result validation failed:", validationError); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: validationError instanceof Error ? validationError.message : String(validationError) + }; + } + return { + success, + data + }; + } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: errorMessage + }; + } + }; + matchDynamicFilterResult = (result, datum, selectorType = "table") => { + if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); + if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); + return result.some((item) => matchesDatum(datum, item)); + }; + selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { + if (!selectorConfig) return true; + if (isValueDynamicFilter(selectorConfig)) { + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + } + const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; + if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + }; +})); +//#endregion +//#region ../vseed/dist/esm/dataSelector/index.js +var init_dataSelector$1 = __esmMin((() => { + init_selector$1(); +})); +//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.js var reverseStackCornerRadius, mergeStackCornerRadius, getStackRangeCornerRadius, callbacks, createCornerRadius, createStackCornerRadius, createBarCornerRadius, hasMoveInAnimation; var init_stackCornerRadiusUtils = __esmMin((() => { @@ -9468,6 +9657,8 @@ var init_stackCornerRadiusUtils = __esmMin((() => { //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js var hasBarMoveInAnimation, stackCornerRadius_stackCornerRadius; var init_stackCornerRadius$2 = __esmMin((() => { + init_es(); + init_dataSelector$1(); init_stackCornerRadiusUtils(); hasBarMoveInAnimation = (spec) => [ spec.animationAppear, @@ -9478,13 +9669,23 @@ var init_stackCornerRadius$2 = __esmMin((() => { stackCornerRadius_stackCornerRadius = (spec, context) => { const { advancedVSeed, vseed } = context; const { chartType } = vseed; - const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius; - const styles = advancedVSeed.markStyle?.barStyle; - if (null == stackCornerRadius || (Array.isArray(styles) ? styles : styles ? [styles] : []).some((rule) => null != rule.barRadius)) return spec; - if (!(advancedVSeed.datasetReshapeInfo?.[0]?.unfoldInfo.colorItems.length === 1) && !hasBarMoveInAnimation(spec)) return { - ...spec, - stackCornerRadius: createStackCornerRadius(stackCornerRadius) - }; + const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius ?? 0; + if (!hasBarMoveInAnimation(spec)) { + const styles = advancedVSeed.markStyle?.barStyle; + const rules = (Array.isArray(styles) ? styles : styles ? [styles] : []).filter((rule) => null != rule.barRadius).reverse(); + const defaultRadius = createStackCornerRadius(stackCornerRadius); + const clipRadius = rules.length ? (attributes, datum) => { + const radius = defaultRadius(attributes, datum); + const rule = rules.find((rule) => rule.dynamicFilter ? selectorWithDynamicFilter(datum, rule.dynamicFilter, rule.selector) : selector_selector(datum, rule.selector)); + if (!rule) return radius; + const barRadius = normalizePadding(rule.barRadius); + return normalizePadding(radius).map((corner, index) => Math.min(corner, barRadius[index])); + } : defaultRadius; + return { + ...spec, + stackCornerRadius: clipRadius + }; + } return { ...spec, bar: { @@ -10492,195 +10693,6 @@ var init_tooltip$3 = __esmMin((() => { init_tooltipSankey(); })); //#endregion -//#region ../vseed/dist/esm/dataSelector/selector.js -function nearlyEqual(a, b, epsilon = 1e-8) { - if (Number.isNaN(a) || Number.isNaN(b)) return false; - if (a === b) return true; - return Math.abs(a - b) <= epsilon; -} -var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; -var init_selector$1 = __esmMin((() => { - init_dist$1(); - init_sandbox(); - init_dataReshape(); - selector_selector = (vchartDatum, selector, selectorMode = "And") => { - if (!selector) return true; - const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); - return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { - if (isValueSelector(selector)) return selectByValue(selector, datum); - else if (isFieldSelector(selector)) return selectByField(selector, datum); - else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); - else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); - else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); - return false; - }); - }; - isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; - isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; - isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); - isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.operator) || [ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.op)); - isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); - selectByMeasure = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "=": - if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "==": - if (datum[selector.field] === selectorValueArr[0]) return true; - break; - case "!=": - if (datum[selector.field] !== selectorValueArr[0]) return true; - break; - case ">": - if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<": - if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case ">=": - if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<=": - if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "between": - if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; - break; - } - return false; - }; - selectByDmension = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "in": - if (selectorValueArr.includes(datum[selector.field])) return true; - break; - case "not in": - if (!selectorValueArr.includes(datum[selector.field])) return true; - break; - } - return false; - }; - selectByField = (selector, datum) => { - const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; - const datumKeys = Object.keys(datum); - return fields.some((field) => datumKeys.includes(field)); - }; - matchesFieldSelector = (field, fieldSelector) => { - return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); - }; - selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); - selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); - matchesCellSelector = (cell, filterRes) => { - if (filterRes["__row_index"] !== cell["__row_index"]) return false; - return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); - }; - matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); - isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; - isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); - isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); - isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); - validateFilterResult = (result, filter) => { - if (isValueDynamicFilter(filter)) { - if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); - return; - } - if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); - if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { - const item = result[i]; - if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); - if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); - if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); - } - }; - executeDynamicFilter = async (filter, allData) => { - try { - const { success, data, error } = await executeFilterCode({ - code: filter.code, - data: allData - }); - if (!success) { - console.warn("[vseed] Dynamic filter execution failed:", error); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error - }; - } - try { - validateFilterResult(data, filter); - } catch (validationError) { - console.error("[vseed] Dynamic filter result validation failed:", validationError); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: validationError instanceof Error ? validationError.message : String(validationError) - }; - } - return { - success, - data - }; - } catch (error) { - const errorMessage = error instanceof Error ? error.message : String(error); - console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: errorMessage - }; - } - }; - matchDynamicFilterResult = (result, datum, selectorType = "table") => { - if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); - if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); - return result.some((item) => matchesDatum(datum, item)); - }; - selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { - if (!selectorConfig) return true; - if (isValueDynamicFilter(selectorConfig)) { - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - } - const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; - if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - }; -})); -//#endregion -//#region ../vseed/dist/esm/dataSelector/index.js -var init_dataSelector$1 = __esmMin((() => { - init_selector$1(); -})); -//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/label/label.js var label_label, generateMeasureValue, generateMeasurePercent, buildLabel$2; var init_label$3 = __esmMin((() => { diff --git a/apps/website/docs/public/storybook/id-ID/assets/vendor.js b/apps/website/docs/public/storybook/id-ID/assets/vendor.js index 173d315829..a2db127c02 100644 --- a/apps/website/docs/public/storybook/id-ID/assets/vendor.js +++ b/apps/website/docs/public/storybook/id-ID/assets/vendor.js @@ -50363,7 +50363,7 @@ var init_color$6 = __esmMin((() => { var init_type$70 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.24/node_modules/@visactor/vutils/es/padding.js -function normalizePadding(padding) { +function normalizePadding$1(padding) { if (isValidNumber$1(padding)) return [ padding, padding, @@ -97171,7 +97171,7 @@ var init_tag$3 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -98052,7 +98052,7 @@ var init_line$16 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis$1.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -98357,7 +98357,7 @@ var init_line$16 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize$1(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -101898,7 +101898,7 @@ var init_scrollbar$3 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -101910,7 +101910,7 @@ var init_scrollbar$3 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -102182,7 +102182,7 @@ var init_poptip$4 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -106455,7 +106455,7 @@ var init_pager$3 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE$1, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -106557,7 +106557,7 @@ var init_base$20 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator$1.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -106574,7 +106574,7 @@ var init_base$20 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -106790,7 +106790,7 @@ var init_discrete$4 = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator$1.group({ x: 0, @@ -108038,7 +108038,7 @@ var init_title$9 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -109310,7 +109310,7 @@ var init_tooltip$6 = __esmMin((() => { const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure, align } = this.attribute; if (!visible) return void this.hideAll(); autoMeasure && Tooltip$2.measureTooltip(this.attribute), autoCalculatePosition && Tooltip$2.calculateTooltipPosition(this.attribute); - const padding = normalizePadding(this.attribute.padding); + const padding = normalizePadding$1(this.attribute.padding); this._tooltipPanel = this.createOrUpdateChild("tooltip-background", Object.assign({ visible: !0 }, panel), "rect"), this._tooltipTitleContainer = this.createOrUpdateChild("tooltip-title", { visible: !0, x: padding[3], @@ -109405,7 +109405,7 @@ var init_tooltip$6 = __esmMin((() => { return "left" === positionX ? x -= tooltipBoxWidth + offsetX : "center" === positionX ? x -= tooltipBoxWidth / 2 : x += offsetX, "top" === positionY ? y -= tooltipBoxHeight + offsetY : "middle" === positionY ? y -= tooltipBoxHeight / 2 : y += offsetY, x + tooltipBoxWidth > parentBounds.x2 && (x -= tooltipBoxWidth + offsetX), y + tooltipBoxHeight > parentBounds.y2 && (y -= tooltipBoxHeight + offsetY), x < parentBounds.x1 && (x = parentBounds.x1), y < parentBounds.y1 && (y = parentBounds.y1), attribute.x = x, attribute.y = y, attribute; } static measureTooltip(attribute) { - const { content, contentStyle } = attribute, padding = normalizePadding(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); + const { content, contentStyle } = attribute, padding = normalizePadding$1(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); let maxWidth = 0, containerHeight = padding[0] + padding[2], titleMaxHeight = 0; const { value: titleValue, shape: titleShape } = titleAttr, { visible: titleHasShape = !1, symbolType: titleShapeType = "" } = null != titleShape ? titleShape : {}; if (isValid$1(titleValue) && "object" != typeof titleAttr.value.text) { @@ -124115,7 +124115,7 @@ var init_heatmap$2 = __esmMin((() => { } initCellBackgroundMarkStyle() { var _a, _b, _c; - const padding = normalizePadding(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); + const padding = normalizePadding$1(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); this.setMarkStyle(this._backgroundMark, { x: (datum) => { const width = this.getCellSize(this._xAxisHelper); @@ -130876,7 +130876,7 @@ function transformLabelAttributes(label, markerData, markAttributeContext) { return (null == shape ? void 0 : shape.visible) ? labelAttrs.shape = Object.assign({ visible: !0 }, transformToGraphic$1(shape.style)) : labelAttrs.shape = { visible: !1 }, !1 !== labelBackground.visible ? (labelAttrs.panel = Object.assign({ visible: !0, customShape: labelBackground.customShape - }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; + }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding$1(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; } return { visible: !1 }; } @@ -134695,7 +134695,7 @@ var init_style$5 = __esmMin((() => { let panelPadding = null; null != border && border.color && (panelStyle.borderColor = border.color), backgroundColor && (panelStyle.backgroundColor = backgroundColor), panelStyle.boxShadow = shadow ? `${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.spread}px ${shadow.color}` : "initial"; const { radius } = null != border ? border : {}; - return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { + return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding$1(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { panelStyle, panelPadding }; @@ -135019,7 +135019,7 @@ var init_attribute = __esmMin((() => { }; getTooltipAttributes = (actualTooltip, spec, globalFontFamily) => { var _a, _b, _c, _d, _e; - const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { + const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding$1(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { fill: !0, size: null !== (_a = null == shape ? void 0 : shape.size) && void 0 !== _a ? _a : 8, spacing: null !== (_b = null == shape ? void 0 : shape.spacing) && void 0 !== _b ? _b : 6 @@ -156416,7 +156416,7 @@ var init_scrollbar$1 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -156428,7 +156428,7 @@ var init_scrollbar$1 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -156647,7 +156647,7 @@ var init_tag$1 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -156882,7 +156882,7 @@ var init_poptip$1 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -163699,7 +163699,7 @@ var init_line$3 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -164004,7 +164004,7 @@ var init_line$3 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -164572,7 +164572,7 @@ var init_pager$1 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -164674,7 +164674,7 @@ var init_base$1 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -164691,7 +164691,7 @@ var init_base$1 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -164901,7 +164901,7 @@ var init_discrete = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator.group({ x: 0, @@ -166113,7 +166113,7 @@ var init_title$4 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -169074,7 +169074,65 @@ var init_color = __esmMin((() => { var init_type$1 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/padding.js -var init_padding$1 = __esmMin((() => {})); +function normalizePadding(padding) { + if (isValidNumber(padding)) return [ + padding, + padding, + padding, + padding + ]; + if (isArray$1(padding)) { + const length = padding.length; + if (1 === length) { + const paddingValue = padding[0]; + return [ + paddingValue, + paddingValue, + paddingValue, + paddingValue + ]; + } + if (2 === length) { + const [vertical, horizontal] = padding; + return [ + vertical, + horizontal, + vertical, + horizontal + ]; + } + if (3 === length) { + const [top, horizontal, bottom] = padding; + return [ + top, + horizontal, + bottom, + horizontal + ]; + } + if (4 === length) return padding; + } + if (isObject$9(padding)) { + const { top = 0, right = 0, bottom = 0, left = 0 } = padding; + return [ + top, + right, + bottom, + left + ]; + } + return [ + 0, + 0, + 0, + 0 + ]; +} +var init_padding$1 = __esmMin((() => { + init_isValidNumber(); + init_isArray(); + init_isObject(); +})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/time/formatUtils.js var init_formatUtils = __esmMin((() => {})); @@ -283933,4 +283991,4 @@ var init_mocker_runtime = __esmMin((() => { globalThis.__STORYBOOK_MOCKER__ = registerModuleMocker(() => new ModuleMockerInterceptor()); })); //#endregion -export { d$2 as $, init_Color as $t, init_yjs as A, H$2 as An, m$2 as At, date as B, preview_exports as Bn, PivotTableAll as Bt, init_kysely as C, isUndefined$1 as Cn, D$2 as Ct, YMap as D, init_esm$1 as Dn, i$5 as Dt, YArray as E, esm_default as En, r$3 as Et, _enum as F, h$3 as Fn, C$3 as Ft, number as G, init_chunk_6OBW3LSX as Gn, boxplot as Gt, init_schemas as H, init_entry_preview_docs as Hn, ListTableAll as Ht, any$1 as I, init_client as In, init_chunk_3GOCSNFN as It, string as J, init_entry_preview as Jn, init_bin as Jt, object as K, setCustomElementsManifest as Kn, init_boxplot as Kt, array as L, proxyCustomElement as Ln, init_es$1 as Lt, init_v4 as M, createEvent as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, forceUpdate as Nn, i$7 as Nt, applyUpdate as O, StreamLight$1 as On, init_chunk_2T7K3PFL as Ot, init_zod as P, getRenderingRef as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, setup as Qn, Color as Qt, boolean as R, transformTag as Rn, PivotChart as Rt, Kysely as S, init_isUndefined as Sn, y$2 as St, UndoManager as T, isNil as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_argtypes_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, entry_preview_docs_exports as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_argtypes as Wn, init_es$4 as Wt, union as X, init_preload_helper as Xn, init_register$1 as Xt, tuple as Y, __vitePreload as Yn, chartModule as Yt, require_tinycolor as Z, init_runtime as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, pickWithout as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, regressionPolynomial as an, init_chunk_BO3LQZNF as at, init_sql as b, init_isArray as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_logistic as cn, n$2 as ct, init_LikeFilled as d, regressionLinear as dn, e$1 as dt, ecdf as en, init_chunk_BCBB46UE as et, init_dist$2 as f, clamper as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, init_pickWithout as gn, t$1 as gt, init_postgres_adapter as h, init_array$1 as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_regression_polynomial as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, Host as jn, T$2 as jt, encodeStateAsUpdate as k, init_streamLight$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLogistic as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, array$2 as mn, n$3 as mt, init_mocker_runtime as n, init_kde as nn, k$2 as nt, SettingOutlined as o, init_regression_lowess as on, o$2 as ot, init_esm as p, init_clamper as pn, init_chunk_JK3VNB42 as pt, record as q, entry_preview_exports as qn, bin as qt, init_es as r, kde as rn, i$3 as rt, init_SettingOutlined as s, regressionLowess as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_ecdf as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_linear as un, o$3 as ut, DummyDriver as v, init_merge as vn, t$2 as vt, Doc as w, init_isNil as wn, init_chunk_PDQFB3TV as wt, sql as x, isArray$1 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, merge$2 as yn, i$4 as yt, custom as z, init_preview as zn, init_PivotChart as zt }; +export { d$2 as $, init_runtime as $n, normalizePadding as $t, init_yjs as A, StreamLight$1 as An, m$2 as At, date as B, transformTag as Bn, PivotTableAll as Bt, init_kysely as C, isArray$1 as Cn, D$2 as Ct, YMap as D, isNil as Dn, i$5 as Dt, YArray as E, init_isNil as En, r$3 as Et, _enum as F, forceUpdate as Fn, C$3 as Ft, number as G, entry_preview_argtypes_exports as Gn, boxplot as Gt, init_schemas as H, preview_exports as Hn, ListTableAll as Ht, any$1 as I, getRenderingRef as In, init_chunk_3GOCSNFN as It, string as J, setCustomElementsManifest as Jn, init_bin as Jt, object as K, init_entry_preview_argtypes as Kn, init_boxplot as Kt, array as L, h$3 as Ln, init_es$1 as Lt, init_v4 as M, H$2 as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, Host as Nn, i$7 as Nt, applyUpdate as O, esm_default as On, init_chunk_2T7K3PFL as Ot, init_zod as P, createEvent as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, init_preload_helper as Qn, init_padding$1 as Qt, boolean as R, init_client as Rn, PivotChart as Rt, Kysely as S, init_isArray as Sn, y$2 as St, UndoManager as T, isUndefined$1 as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_docs_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, init_preview as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_docs as Wn, init_es$4 as Wt, union as X, init_entry_preview as Xn, init_register$1 as Xt, tuple as Y, entry_preview_exports as Yn, chartModule as Yt, require_tinycolor as Z, __vitePreload as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, init_array$1 as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, kde as an, init_chunk_BO3LQZNF as at, init_sql as b, init_merge as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_lowess as cn, n$2 as ct, init_LikeFilled as d, regressionLogistic as dn, e$1 as dt, Color as en, setup as er, init_chunk_BCBB46UE as et, init_dist$2 as f, init_regression_linear as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, array$2 as gn, t$1 as gt, init_postgres_adapter as h, init_clamper as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_kde as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, init_streamLight$1 as jn, T$2 as jt, encodeStateAsUpdate as k, init_esm$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLowess as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, clamper as mn, n$3 as mt, init_mocker_runtime as n, ecdf as nn, k$2 as nt, SettingOutlined as o, init_regression_polynomial as on, o$2 as ot, init_esm as p, regressionLinear as pn, init_chunk_JK3VNB42 as pt, record as q, init_chunk_6OBW3LSX as qn, bin as qt, init_es as r, init_ecdf as rn, i$3 as rt, init_SettingOutlined as s, regressionPolynomial as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_Color as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_logistic as un, o$3 as ut, DummyDriver as v, init_pickWithout as vn, t$2 as vt, Doc as w, init_isUndefined as wn, init_chunk_PDQFB3TV as wt, sql as x, merge$2 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, pickWithout as yn, i$4 as yt, custom as z, proxyCustomElement as zn, init_PivotChart as zt }; diff --git a/apps/website/docs/public/storybook/ja-JP/assets/iframe.js b/apps/website/docs/public/storybook/ja-JP/assets/iframe.js index 58b1e0408a..db59918ff8 100644 --- a/apps/website/docs/public/storybook/ja-JP/assets/iframe.js +++ b/apps/website/docs/public/storybook/ja-JP/assets/iframe.js @@ -1,5 +1,5 @@ import { n as __esmMin, o as __toESM, r as __exportAll } from "./rolldown-runtime.js"; -import { $ as d$6, A as init_yjs, An as H$4, At as m$8, B as date, Bn as preview_exports$1, Bt as PivotTableAll, Cn as isUndefined, Ct as D$4, D as YMap, Dn as init_esm$1, Dt as i$9, E as YArray, En as esm_default, Et as r$11, F as _enum, Fn as h$5, Ft as C$6, G as number, Gt as boxplot, Hn as init_entry_preview_docs, Ht as ListTableAll, I as any, In as init_client, J as string, Jn as init_entry_preview, K as object, Kn as setCustomElementsManifest, L as array$1, Ln as proxyCustomElement, Lt as init_es$2, Mn as createEvent, N as v4, Nn as forceUpdate, Nt as i$7, O as applyUpdate, On as StreamLight, P as init_zod, Pn as getRenderingRef, Q as init_dist$1, Qn as setup, Qt as Color, R as boolean, Rn as transformTag, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isNil, U as lazy, Un as entry_preview_argtypes_exports, V as discriminatedUnion, Vn as entry_preview_docs_exports, W as literal, Wn as init_entry_preview_argtypes, Wt as init_es$1, X as union, Xn as init_preload_helper, Y as tuple, Yn as __vitePreload, Yt as chartModule, Z as require_tinycolor, Zn as init_runtime, Zt as init_es, _n as pickWithout, an as regressionPolynomial, ct as n$11, dn as regressionLinear, dt as e$8, en as ecdf, f as init_dist$3, fn as clamper, g as PostgresQueryCompiler, gt as t$14, j as init_dist$2, jn as Host, jt as T$4, k as encodeStateAsUpdate, ln as regressionLogistic, m as PostgresAdapter, mn as array, mt as n$10, nt as k$7, ot as o$9, p as init_esm$2, q as record, qn as entry_preview_exports, qt as bin, rn as kde, rt as i$10, sn as regressionLowess, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as isArray, yn as merge, yt as i$8, z as custom, zn as init_preview$1 } from "./vendor.js"; +import { $ as d$6, $n as init_runtime, $t as normalizePadding, A as init_yjs, An as StreamLight, At as m$8, B as date, Bn as transformTag, Bt as PivotTableAll, Cn as isArray, Ct as D$4, D as YMap, Dn as isNil, Dt as i$9, E as YArray, Et as r$11, F as _enum, Fn as forceUpdate, Ft as C$6, G as number, Gn as entry_preview_argtypes_exports, Gt as boxplot, Hn as preview_exports$1, Ht as ListTableAll, I as any, In as getRenderingRef, J as string, Jn as setCustomElementsManifest, K as object, Kn as init_entry_preview_argtypes, L as array$1, Ln as h$5, Lt as init_es$2, Mn as H$4, N as v4, Nn as Host, Nt as i$7, O as applyUpdate, On as esm_default, P as init_zod, Pn as createEvent, Q as init_dist$1, Qn as init_preload_helper, R as boolean, Rn as init_client, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isUndefined, U as lazy, Un as entry_preview_docs_exports, V as discriminatedUnion, Vn as init_preview$1, W as literal, Wn as init_entry_preview_docs, Wt as init_es$1, X as union, Xn as init_entry_preview, Y as tuple, Yn as entry_preview_exports, Yt as chartModule, Z as require_tinycolor, Zn as __vitePreload, Zt as init_es, an as kde, ct as n$11, dn as regressionLogistic, dt as e$8, en as Color, er as setup, f as init_dist$3, g as PostgresQueryCompiler, gn as array, gt as t$14, j as init_dist$2, jt as T$4, k as encodeStateAsUpdate, kn as init_esm$1, ln as regressionLowess, m as PostgresAdapter, mn as clamper, mt as n$10, nn as ecdf, nt as k$7, ot as o$9, p as init_esm$2, pn as regressionLinear, q as record, qt as bin, rt as i$10, sn as regressionPolynomial, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as merge, yn as pickWithout, yt as i$8, z as custom, zn as proxyCustomElement } from "./vendor.js"; //#region iframe.html?html-proxy&inline-css&index=0.css var init_iframe_html_html_proxy_inline_css_index_0 = __esmMin((() => {})); //#endregion @@ -9397,6 +9397,195 @@ var init_stack$1 = __esmMin((() => { }; })); //#endregion +//#region ../vseed/dist/esm/dataSelector/selector.js +function nearlyEqual(a, b, epsilon = 1e-8) { + if (Number.isNaN(a) || Number.isNaN(b)) return false; + if (a === b) return true; + return Math.abs(a - b) <= epsilon; +} +var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; +var init_selector$1 = __esmMin((() => { + init_dist$1(); + init_sandbox(); + init_dataReshape(); + selector_selector = (vchartDatum, selector, selectorMode = "And") => { + if (!selector) return true; + const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); + return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { + if (isValueSelector(selector)) return selectByValue(selector, datum); + else if (isFieldSelector(selector)) return selectByField(selector, datum); + else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); + else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); + else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); + return false; + }); + }; + isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; + isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; + isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); + isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.operator) || [ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.op)); + isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); + selectByMeasure = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "=": + if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "==": + if (datum[selector.field] === selectorValueArr[0]) return true; + break; + case "!=": + if (datum[selector.field] !== selectorValueArr[0]) return true; + break; + case ">": + if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<": + if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case ">=": + if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<=": + if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "between": + if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; + break; + } + return false; + }; + selectByDmension = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "in": + if (selectorValueArr.includes(datum[selector.field])) return true; + break; + case "not in": + if (!selectorValueArr.includes(datum[selector.field])) return true; + break; + } + return false; + }; + selectByField = (selector, datum) => { + const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; + const datumKeys = Object.keys(datum); + return fields.some((field) => datumKeys.includes(field)); + }; + matchesFieldSelector = (field, fieldSelector) => { + return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); + }; + selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); + selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); + matchesCellSelector = (cell, filterRes) => { + if (filterRes["__row_index"] !== cell["__row_index"]) return false; + return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); + }; + matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); + isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; + isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); + isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); + isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); + validateFilterResult = (result, filter) => { + if (isValueDynamicFilter(filter)) { + if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); + return; + } + if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); + if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { + const item = result[i]; + if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); + if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); + if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); + } + }; + executeDynamicFilter = async (filter, allData) => { + try { + const { success, data, error } = await executeFilterCode({ + code: filter.code, + data: allData + }); + if (!success) { + console.warn("[vseed] Dynamic filter execution failed:", error); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error + }; + } + try { + validateFilterResult(data, filter); + } catch (validationError) { + console.error("[vseed] Dynamic filter result validation failed:", validationError); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: validationError instanceof Error ? validationError.message : String(validationError) + }; + } + return { + success, + data + }; + } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: errorMessage + }; + } + }; + matchDynamicFilterResult = (result, datum, selectorType = "table") => { + if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); + if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); + return result.some((item) => matchesDatum(datum, item)); + }; + selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { + if (!selectorConfig) return true; + if (isValueDynamicFilter(selectorConfig)) { + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + } + const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; + if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + }; +})); +//#endregion +//#region ../vseed/dist/esm/dataSelector/index.js +var init_dataSelector$1 = __esmMin((() => { + init_selector$1(); +})); +//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.js var reverseStackCornerRadius, mergeStackCornerRadius, getStackRangeCornerRadius, callbacks, createCornerRadius, createStackCornerRadius, createBarCornerRadius, hasMoveInAnimation; var init_stackCornerRadiusUtils = __esmMin((() => { @@ -9468,6 +9657,8 @@ var init_stackCornerRadiusUtils = __esmMin((() => { //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js var hasBarMoveInAnimation, stackCornerRadius_stackCornerRadius; var init_stackCornerRadius$2 = __esmMin((() => { + init_es(); + init_dataSelector$1(); init_stackCornerRadiusUtils(); hasBarMoveInAnimation = (spec) => [ spec.animationAppear, @@ -9478,13 +9669,23 @@ var init_stackCornerRadius$2 = __esmMin((() => { stackCornerRadius_stackCornerRadius = (spec, context) => { const { advancedVSeed, vseed } = context; const { chartType } = vseed; - const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius; - const styles = advancedVSeed.markStyle?.barStyle; - if (null == stackCornerRadius || (Array.isArray(styles) ? styles : styles ? [styles] : []).some((rule) => null != rule.barRadius)) return spec; - if (!(advancedVSeed.datasetReshapeInfo?.[0]?.unfoldInfo.colorItems.length === 1) && !hasBarMoveInAnimation(spec)) return { - ...spec, - stackCornerRadius: createStackCornerRadius(stackCornerRadius) - }; + const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius ?? 0; + if (!hasBarMoveInAnimation(spec)) { + const styles = advancedVSeed.markStyle?.barStyle; + const rules = (Array.isArray(styles) ? styles : styles ? [styles] : []).filter((rule) => null != rule.barRadius).reverse(); + const defaultRadius = createStackCornerRadius(stackCornerRadius); + const clipRadius = rules.length ? (attributes, datum) => { + const radius = defaultRadius(attributes, datum); + const rule = rules.find((rule) => rule.dynamicFilter ? selectorWithDynamicFilter(datum, rule.dynamicFilter, rule.selector) : selector_selector(datum, rule.selector)); + if (!rule) return radius; + const barRadius = normalizePadding(rule.barRadius); + return normalizePadding(radius).map((corner, index) => Math.min(corner, barRadius[index])); + } : defaultRadius; + return { + ...spec, + stackCornerRadius: clipRadius + }; + } return { ...spec, bar: { @@ -10492,195 +10693,6 @@ var init_tooltip$3 = __esmMin((() => { init_tooltipSankey(); })); //#endregion -//#region ../vseed/dist/esm/dataSelector/selector.js -function nearlyEqual(a, b, epsilon = 1e-8) { - if (Number.isNaN(a) || Number.isNaN(b)) return false; - if (a === b) return true; - return Math.abs(a - b) <= epsilon; -} -var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; -var init_selector$1 = __esmMin((() => { - init_dist$1(); - init_sandbox(); - init_dataReshape(); - selector_selector = (vchartDatum, selector, selectorMode = "And") => { - if (!selector) return true; - const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); - return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { - if (isValueSelector(selector)) return selectByValue(selector, datum); - else if (isFieldSelector(selector)) return selectByField(selector, datum); - else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); - else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); - else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); - return false; - }); - }; - isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; - isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; - isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); - isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.operator) || [ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.op)); - isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); - selectByMeasure = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "=": - if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "==": - if (datum[selector.field] === selectorValueArr[0]) return true; - break; - case "!=": - if (datum[selector.field] !== selectorValueArr[0]) return true; - break; - case ">": - if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<": - if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case ">=": - if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<=": - if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "between": - if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; - break; - } - return false; - }; - selectByDmension = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "in": - if (selectorValueArr.includes(datum[selector.field])) return true; - break; - case "not in": - if (!selectorValueArr.includes(datum[selector.field])) return true; - break; - } - return false; - }; - selectByField = (selector, datum) => { - const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; - const datumKeys = Object.keys(datum); - return fields.some((field) => datumKeys.includes(field)); - }; - matchesFieldSelector = (field, fieldSelector) => { - return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); - }; - selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); - selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); - matchesCellSelector = (cell, filterRes) => { - if (filterRes["__row_index"] !== cell["__row_index"]) return false; - return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); - }; - matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); - isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; - isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); - isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); - isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); - validateFilterResult = (result, filter) => { - if (isValueDynamicFilter(filter)) { - if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); - return; - } - if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); - if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { - const item = result[i]; - if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); - if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); - if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); - } - }; - executeDynamicFilter = async (filter, allData) => { - try { - const { success, data, error } = await executeFilterCode({ - code: filter.code, - data: allData - }); - if (!success) { - console.warn("[vseed] Dynamic filter execution failed:", error); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error - }; - } - try { - validateFilterResult(data, filter); - } catch (validationError) { - console.error("[vseed] Dynamic filter result validation failed:", validationError); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: validationError instanceof Error ? validationError.message : String(validationError) - }; - } - return { - success, - data - }; - } catch (error) { - const errorMessage = error instanceof Error ? error.message : String(error); - console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: errorMessage - }; - } - }; - matchDynamicFilterResult = (result, datum, selectorType = "table") => { - if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); - if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); - return result.some((item) => matchesDatum(datum, item)); - }; - selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { - if (!selectorConfig) return true; - if (isValueDynamicFilter(selectorConfig)) { - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - } - const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; - if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - }; -})); -//#endregion -//#region ../vseed/dist/esm/dataSelector/index.js -var init_dataSelector$1 = __esmMin((() => { - init_selector$1(); -})); -//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/label/label.js var label_label, generateMeasureValue, generateMeasurePercent, buildLabel$2; var init_label$3 = __esmMin((() => { diff --git a/apps/website/docs/public/storybook/ja-JP/assets/vendor.js b/apps/website/docs/public/storybook/ja-JP/assets/vendor.js index 173d315829..a2db127c02 100644 --- a/apps/website/docs/public/storybook/ja-JP/assets/vendor.js +++ b/apps/website/docs/public/storybook/ja-JP/assets/vendor.js @@ -50363,7 +50363,7 @@ var init_color$6 = __esmMin((() => { var init_type$70 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.24/node_modules/@visactor/vutils/es/padding.js -function normalizePadding(padding) { +function normalizePadding$1(padding) { if (isValidNumber$1(padding)) return [ padding, padding, @@ -97171,7 +97171,7 @@ var init_tag$3 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -98052,7 +98052,7 @@ var init_line$16 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis$1.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -98357,7 +98357,7 @@ var init_line$16 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize$1(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -101898,7 +101898,7 @@ var init_scrollbar$3 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -101910,7 +101910,7 @@ var init_scrollbar$3 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -102182,7 +102182,7 @@ var init_poptip$4 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -106455,7 +106455,7 @@ var init_pager$3 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE$1, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -106557,7 +106557,7 @@ var init_base$20 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator$1.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -106574,7 +106574,7 @@ var init_base$20 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -106790,7 +106790,7 @@ var init_discrete$4 = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator$1.group({ x: 0, @@ -108038,7 +108038,7 @@ var init_title$9 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -109310,7 +109310,7 @@ var init_tooltip$6 = __esmMin((() => { const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure, align } = this.attribute; if (!visible) return void this.hideAll(); autoMeasure && Tooltip$2.measureTooltip(this.attribute), autoCalculatePosition && Tooltip$2.calculateTooltipPosition(this.attribute); - const padding = normalizePadding(this.attribute.padding); + const padding = normalizePadding$1(this.attribute.padding); this._tooltipPanel = this.createOrUpdateChild("tooltip-background", Object.assign({ visible: !0 }, panel), "rect"), this._tooltipTitleContainer = this.createOrUpdateChild("tooltip-title", { visible: !0, x: padding[3], @@ -109405,7 +109405,7 @@ var init_tooltip$6 = __esmMin((() => { return "left" === positionX ? x -= tooltipBoxWidth + offsetX : "center" === positionX ? x -= tooltipBoxWidth / 2 : x += offsetX, "top" === positionY ? y -= tooltipBoxHeight + offsetY : "middle" === positionY ? y -= tooltipBoxHeight / 2 : y += offsetY, x + tooltipBoxWidth > parentBounds.x2 && (x -= tooltipBoxWidth + offsetX), y + tooltipBoxHeight > parentBounds.y2 && (y -= tooltipBoxHeight + offsetY), x < parentBounds.x1 && (x = parentBounds.x1), y < parentBounds.y1 && (y = parentBounds.y1), attribute.x = x, attribute.y = y, attribute; } static measureTooltip(attribute) { - const { content, contentStyle } = attribute, padding = normalizePadding(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); + const { content, contentStyle } = attribute, padding = normalizePadding$1(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); let maxWidth = 0, containerHeight = padding[0] + padding[2], titleMaxHeight = 0; const { value: titleValue, shape: titleShape } = titleAttr, { visible: titleHasShape = !1, symbolType: titleShapeType = "" } = null != titleShape ? titleShape : {}; if (isValid$1(titleValue) && "object" != typeof titleAttr.value.text) { @@ -124115,7 +124115,7 @@ var init_heatmap$2 = __esmMin((() => { } initCellBackgroundMarkStyle() { var _a, _b, _c; - const padding = normalizePadding(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); + const padding = normalizePadding$1(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); this.setMarkStyle(this._backgroundMark, { x: (datum) => { const width = this.getCellSize(this._xAxisHelper); @@ -130876,7 +130876,7 @@ function transformLabelAttributes(label, markerData, markAttributeContext) { return (null == shape ? void 0 : shape.visible) ? labelAttrs.shape = Object.assign({ visible: !0 }, transformToGraphic$1(shape.style)) : labelAttrs.shape = { visible: !1 }, !1 !== labelBackground.visible ? (labelAttrs.panel = Object.assign({ visible: !0, customShape: labelBackground.customShape - }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; + }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding$1(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; } return { visible: !1 }; } @@ -134695,7 +134695,7 @@ var init_style$5 = __esmMin((() => { let panelPadding = null; null != border && border.color && (panelStyle.borderColor = border.color), backgroundColor && (panelStyle.backgroundColor = backgroundColor), panelStyle.boxShadow = shadow ? `${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.spread}px ${shadow.color}` : "initial"; const { radius } = null != border ? border : {}; - return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { + return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding$1(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { panelStyle, panelPadding }; @@ -135019,7 +135019,7 @@ var init_attribute = __esmMin((() => { }; getTooltipAttributes = (actualTooltip, spec, globalFontFamily) => { var _a, _b, _c, _d, _e; - const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { + const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding$1(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { fill: !0, size: null !== (_a = null == shape ? void 0 : shape.size) && void 0 !== _a ? _a : 8, spacing: null !== (_b = null == shape ? void 0 : shape.spacing) && void 0 !== _b ? _b : 6 @@ -156416,7 +156416,7 @@ var init_scrollbar$1 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -156428,7 +156428,7 @@ var init_scrollbar$1 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -156647,7 +156647,7 @@ var init_tag$1 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -156882,7 +156882,7 @@ var init_poptip$1 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -163699,7 +163699,7 @@ var init_line$3 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -164004,7 +164004,7 @@ var init_line$3 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -164572,7 +164572,7 @@ var init_pager$1 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -164674,7 +164674,7 @@ var init_base$1 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -164691,7 +164691,7 @@ var init_base$1 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -164901,7 +164901,7 @@ var init_discrete = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator.group({ x: 0, @@ -166113,7 +166113,7 @@ var init_title$4 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -169074,7 +169074,65 @@ var init_color = __esmMin((() => { var init_type$1 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/padding.js -var init_padding$1 = __esmMin((() => {})); +function normalizePadding(padding) { + if (isValidNumber(padding)) return [ + padding, + padding, + padding, + padding + ]; + if (isArray$1(padding)) { + const length = padding.length; + if (1 === length) { + const paddingValue = padding[0]; + return [ + paddingValue, + paddingValue, + paddingValue, + paddingValue + ]; + } + if (2 === length) { + const [vertical, horizontal] = padding; + return [ + vertical, + horizontal, + vertical, + horizontal + ]; + } + if (3 === length) { + const [top, horizontal, bottom] = padding; + return [ + top, + horizontal, + bottom, + horizontal + ]; + } + if (4 === length) return padding; + } + if (isObject$9(padding)) { + const { top = 0, right = 0, bottom = 0, left = 0 } = padding; + return [ + top, + right, + bottom, + left + ]; + } + return [ + 0, + 0, + 0, + 0 + ]; +} +var init_padding$1 = __esmMin((() => { + init_isValidNumber(); + init_isArray(); + init_isObject(); +})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/time/formatUtils.js var init_formatUtils = __esmMin((() => {})); @@ -283933,4 +283991,4 @@ var init_mocker_runtime = __esmMin((() => { globalThis.__STORYBOOK_MOCKER__ = registerModuleMocker(() => new ModuleMockerInterceptor()); })); //#endregion -export { d$2 as $, init_Color as $t, init_yjs as A, H$2 as An, m$2 as At, date as B, preview_exports as Bn, PivotTableAll as Bt, init_kysely as C, isUndefined$1 as Cn, D$2 as Ct, YMap as D, init_esm$1 as Dn, i$5 as Dt, YArray as E, esm_default as En, r$3 as Et, _enum as F, h$3 as Fn, C$3 as Ft, number as G, init_chunk_6OBW3LSX as Gn, boxplot as Gt, init_schemas as H, init_entry_preview_docs as Hn, ListTableAll as Ht, any$1 as I, init_client as In, init_chunk_3GOCSNFN as It, string as J, init_entry_preview as Jn, init_bin as Jt, object as K, setCustomElementsManifest as Kn, init_boxplot as Kt, array as L, proxyCustomElement as Ln, init_es$1 as Lt, init_v4 as M, createEvent as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, forceUpdate as Nn, i$7 as Nt, applyUpdate as O, StreamLight$1 as On, init_chunk_2T7K3PFL as Ot, init_zod as P, getRenderingRef as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, setup as Qn, Color as Qt, boolean as R, transformTag as Rn, PivotChart as Rt, Kysely as S, init_isUndefined as Sn, y$2 as St, UndoManager as T, isNil as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_argtypes_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, entry_preview_docs_exports as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_argtypes as Wn, init_es$4 as Wt, union as X, init_preload_helper as Xn, init_register$1 as Xt, tuple as Y, __vitePreload as Yn, chartModule as Yt, require_tinycolor as Z, init_runtime as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, pickWithout as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, regressionPolynomial as an, init_chunk_BO3LQZNF as at, init_sql as b, init_isArray as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_logistic as cn, n$2 as ct, init_LikeFilled as d, regressionLinear as dn, e$1 as dt, ecdf as en, init_chunk_BCBB46UE as et, init_dist$2 as f, clamper as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, init_pickWithout as gn, t$1 as gt, init_postgres_adapter as h, init_array$1 as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_regression_polynomial as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, Host as jn, T$2 as jt, encodeStateAsUpdate as k, init_streamLight$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLogistic as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, array$2 as mn, n$3 as mt, init_mocker_runtime as n, init_kde as nn, k$2 as nt, SettingOutlined as o, init_regression_lowess as on, o$2 as ot, init_esm as p, init_clamper as pn, init_chunk_JK3VNB42 as pt, record as q, entry_preview_exports as qn, bin as qt, init_es as r, kde as rn, i$3 as rt, init_SettingOutlined as s, regressionLowess as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_ecdf as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_linear as un, o$3 as ut, DummyDriver as v, init_merge as vn, t$2 as vt, Doc as w, init_isNil as wn, init_chunk_PDQFB3TV as wt, sql as x, isArray$1 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, merge$2 as yn, i$4 as yt, custom as z, init_preview as zn, init_PivotChart as zt }; +export { d$2 as $, init_runtime as $n, normalizePadding as $t, init_yjs as A, StreamLight$1 as An, m$2 as At, date as B, transformTag as Bn, PivotTableAll as Bt, init_kysely as C, isArray$1 as Cn, D$2 as Ct, YMap as D, isNil as Dn, i$5 as Dt, YArray as E, init_isNil as En, r$3 as Et, _enum as F, forceUpdate as Fn, C$3 as Ft, number as G, entry_preview_argtypes_exports as Gn, boxplot as Gt, init_schemas as H, preview_exports as Hn, ListTableAll as Ht, any$1 as I, getRenderingRef as In, init_chunk_3GOCSNFN as It, string as J, setCustomElementsManifest as Jn, init_bin as Jt, object as K, init_entry_preview_argtypes as Kn, init_boxplot as Kt, array as L, h$3 as Ln, init_es$1 as Lt, init_v4 as M, H$2 as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, Host as Nn, i$7 as Nt, applyUpdate as O, esm_default as On, init_chunk_2T7K3PFL as Ot, init_zod as P, createEvent as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, init_preload_helper as Qn, init_padding$1 as Qt, boolean as R, init_client as Rn, PivotChart as Rt, Kysely as S, init_isArray as Sn, y$2 as St, UndoManager as T, isUndefined$1 as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_docs_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, init_preview as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_docs as Wn, init_es$4 as Wt, union as X, init_entry_preview as Xn, init_register$1 as Xt, tuple as Y, entry_preview_exports as Yn, chartModule as Yt, require_tinycolor as Z, __vitePreload as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, init_array$1 as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, kde as an, init_chunk_BO3LQZNF as at, init_sql as b, init_merge as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_lowess as cn, n$2 as ct, init_LikeFilled as d, regressionLogistic as dn, e$1 as dt, Color as en, setup as er, init_chunk_BCBB46UE as et, init_dist$2 as f, init_regression_linear as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, array$2 as gn, t$1 as gt, init_postgres_adapter as h, init_clamper as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_kde as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, init_streamLight$1 as jn, T$2 as jt, encodeStateAsUpdate as k, init_esm$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLowess as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, clamper as mn, n$3 as mt, init_mocker_runtime as n, ecdf as nn, k$2 as nt, SettingOutlined as o, init_regression_polynomial as on, o$2 as ot, init_esm as p, regressionLinear as pn, init_chunk_JK3VNB42 as pt, record as q, init_chunk_6OBW3LSX as qn, bin as qt, init_es as r, init_ecdf as rn, i$3 as rt, init_SettingOutlined as s, regressionPolynomial as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_Color as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_logistic as un, o$3 as ut, DummyDriver as v, init_pickWithout as vn, t$2 as vt, Doc as w, init_isUndefined as wn, init_chunk_PDQFB3TV as wt, sql as x, merge$2 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, pickWithout as yn, i$4 as yt, custom as z, proxyCustomElement as zn, init_PivotChart as zt }; diff --git a/apps/website/docs/public/storybook/ko-KR/assets/iframe.js b/apps/website/docs/public/storybook/ko-KR/assets/iframe.js index 3ed1a72f4d..5f54dee80f 100644 --- a/apps/website/docs/public/storybook/ko-KR/assets/iframe.js +++ b/apps/website/docs/public/storybook/ko-KR/assets/iframe.js @@ -1,5 +1,5 @@ import { n as __esmMin, o as __toESM, r as __exportAll } from "./rolldown-runtime.js"; -import { $ as d$6, A as init_yjs, An as H$4, At as m$8, B as date, Bn as preview_exports$1, Bt as PivotTableAll, Cn as isUndefined, Ct as D$4, D as YMap, Dn as init_esm$1, Dt as i$9, E as YArray, En as esm_default, Et as r$11, F as _enum, Fn as h$5, Ft as C$6, G as number, Gt as boxplot, Hn as init_entry_preview_docs, Ht as ListTableAll, I as any, In as init_client, J as string, Jn as init_entry_preview, K as object, Kn as setCustomElementsManifest, L as array$1, Ln as proxyCustomElement, Lt as init_es$2, Mn as createEvent, N as v4, Nn as forceUpdate, Nt as i$7, O as applyUpdate, On as StreamLight, P as init_zod, Pn as getRenderingRef, Q as init_dist$1, Qn as setup, Qt as Color, R as boolean, Rn as transformTag, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isNil, U as lazy, Un as entry_preview_argtypes_exports, V as discriminatedUnion, Vn as entry_preview_docs_exports, W as literal, Wn as init_entry_preview_argtypes, Wt as init_es$1, X as union, Xn as init_preload_helper, Y as tuple, Yn as __vitePreload, Yt as chartModule, Z as require_tinycolor, Zn as init_runtime, Zt as init_es, _n as pickWithout, an as regressionPolynomial, ct as n$11, dn as regressionLinear, dt as e$8, en as ecdf, f as init_dist$3, fn as clamper, g as PostgresQueryCompiler, gt as t$14, j as init_dist$2, jn as Host, jt as T$4, k as encodeStateAsUpdate, ln as regressionLogistic, m as PostgresAdapter, mn as array, mt as n$10, nt as k$7, ot as o$9, p as init_esm$2, q as record, qn as entry_preview_exports, qt as bin, rn as kde, rt as i$10, sn as regressionLowess, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as isArray, yn as merge, yt as i$8, z as custom, zn as init_preview$1 } from "./vendor.js"; +import { $ as d$6, $n as init_runtime, $t as normalizePadding, A as init_yjs, An as StreamLight, At as m$8, B as date, Bn as transformTag, Bt as PivotTableAll, Cn as isArray, Ct as D$4, D as YMap, Dn as isNil, Dt as i$9, E as YArray, Et as r$11, F as _enum, Fn as forceUpdate, Ft as C$6, G as number, Gn as entry_preview_argtypes_exports, Gt as boxplot, Hn as preview_exports$1, Ht as ListTableAll, I as any, In as getRenderingRef, J as string, Jn as setCustomElementsManifest, K as object, Kn as init_entry_preview_argtypes, L as array$1, Ln as h$5, Lt as init_es$2, Mn as H$4, N as v4, Nn as Host, Nt as i$7, O as applyUpdate, On as esm_default, P as init_zod, Pn as createEvent, Q as init_dist$1, Qn as init_preload_helper, R as boolean, Rn as init_client, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isUndefined, U as lazy, Un as entry_preview_docs_exports, V as discriminatedUnion, Vn as init_preview$1, W as literal, Wn as init_entry_preview_docs, Wt as init_es$1, X as union, Xn as init_entry_preview, Y as tuple, Yn as entry_preview_exports, Yt as chartModule, Z as require_tinycolor, Zn as __vitePreload, Zt as init_es, an as kde, ct as n$11, dn as regressionLogistic, dt as e$8, en as Color, er as setup, f as init_dist$3, g as PostgresQueryCompiler, gn as array, gt as t$14, j as init_dist$2, jt as T$4, k as encodeStateAsUpdate, kn as init_esm$1, ln as regressionLowess, m as PostgresAdapter, mn as clamper, mt as n$10, nn as ecdf, nt as k$7, ot as o$9, p as init_esm$2, pn as regressionLinear, q as record, qt as bin, rt as i$10, sn as regressionPolynomial, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as merge, yn as pickWithout, yt as i$8, z as custom, zn as proxyCustomElement } from "./vendor.js"; //#region iframe.html?html-proxy&inline-css&index=0.css var init_iframe_html_html_proxy_inline_css_index_0 = __esmMin((() => {})); //#endregion @@ -9397,6 +9397,195 @@ var init_stack$1 = __esmMin((() => { }; })); //#endregion +//#region ../vseed/dist/esm/dataSelector/selector.js +function nearlyEqual(a, b, epsilon = 1e-8) { + if (Number.isNaN(a) || Number.isNaN(b)) return false; + if (a === b) return true; + return Math.abs(a - b) <= epsilon; +} +var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; +var init_selector$1 = __esmMin((() => { + init_dist$1(); + init_sandbox(); + init_dataReshape(); + selector_selector = (vchartDatum, selector, selectorMode = "And") => { + if (!selector) return true; + const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); + return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { + if (isValueSelector(selector)) return selectByValue(selector, datum); + else if (isFieldSelector(selector)) return selectByField(selector, datum); + else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); + else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); + else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); + return false; + }); + }; + isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; + isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; + isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); + isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.operator) || [ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.op)); + isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); + selectByMeasure = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "=": + if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "==": + if (datum[selector.field] === selectorValueArr[0]) return true; + break; + case "!=": + if (datum[selector.field] !== selectorValueArr[0]) return true; + break; + case ">": + if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<": + if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case ">=": + if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<=": + if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "between": + if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; + break; + } + return false; + }; + selectByDmension = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "in": + if (selectorValueArr.includes(datum[selector.field])) return true; + break; + case "not in": + if (!selectorValueArr.includes(datum[selector.field])) return true; + break; + } + return false; + }; + selectByField = (selector, datum) => { + const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; + const datumKeys = Object.keys(datum); + return fields.some((field) => datumKeys.includes(field)); + }; + matchesFieldSelector = (field, fieldSelector) => { + return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); + }; + selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); + selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); + matchesCellSelector = (cell, filterRes) => { + if (filterRes["__row_index"] !== cell["__row_index"]) return false; + return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); + }; + matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); + isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; + isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); + isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); + isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); + validateFilterResult = (result, filter) => { + if (isValueDynamicFilter(filter)) { + if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); + return; + } + if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); + if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { + const item = result[i]; + if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); + if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); + if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); + } + }; + executeDynamicFilter = async (filter, allData) => { + try { + const { success, data, error } = await executeFilterCode({ + code: filter.code, + data: allData + }); + if (!success) { + console.warn("[vseed] Dynamic filter execution failed:", error); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error + }; + } + try { + validateFilterResult(data, filter); + } catch (validationError) { + console.error("[vseed] Dynamic filter result validation failed:", validationError); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: validationError instanceof Error ? validationError.message : String(validationError) + }; + } + return { + success, + data + }; + } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: errorMessage + }; + } + }; + matchDynamicFilterResult = (result, datum, selectorType = "table") => { + if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); + if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); + return result.some((item) => matchesDatum(datum, item)); + }; + selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { + if (!selectorConfig) return true; + if (isValueDynamicFilter(selectorConfig)) { + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + } + const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; + if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + }; +})); +//#endregion +//#region ../vseed/dist/esm/dataSelector/index.js +var init_dataSelector$1 = __esmMin((() => { + init_selector$1(); +})); +//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.js var reverseStackCornerRadius, mergeStackCornerRadius, getStackRangeCornerRadius, callbacks, createCornerRadius, createStackCornerRadius, createBarCornerRadius, hasMoveInAnimation; var init_stackCornerRadiusUtils = __esmMin((() => { @@ -9468,6 +9657,8 @@ var init_stackCornerRadiusUtils = __esmMin((() => { //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js var hasBarMoveInAnimation, stackCornerRadius_stackCornerRadius; var init_stackCornerRadius$2 = __esmMin((() => { + init_es(); + init_dataSelector$1(); init_stackCornerRadiusUtils(); hasBarMoveInAnimation = (spec) => [ spec.animationAppear, @@ -9478,13 +9669,23 @@ var init_stackCornerRadius$2 = __esmMin((() => { stackCornerRadius_stackCornerRadius = (spec, context) => { const { advancedVSeed, vseed } = context; const { chartType } = vseed; - const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius; - const styles = advancedVSeed.markStyle?.barStyle; - if (null == stackCornerRadius || (Array.isArray(styles) ? styles : styles ? [styles] : []).some((rule) => null != rule.barRadius)) return spec; - if (!(advancedVSeed.datasetReshapeInfo?.[0]?.unfoldInfo.colorItems.length === 1) && !hasBarMoveInAnimation(spec)) return { - ...spec, - stackCornerRadius: createStackCornerRadius(stackCornerRadius) - }; + const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius ?? 0; + if (!hasBarMoveInAnimation(spec)) { + const styles = advancedVSeed.markStyle?.barStyle; + const rules = (Array.isArray(styles) ? styles : styles ? [styles] : []).filter((rule) => null != rule.barRadius).reverse(); + const defaultRadius = createStackCornerRadius(stackCornerRadius); + const clipRadius = rules.length ? (attributes, datum) => { + const radius = defaultRadius(attributes, datum); + const rule = rules.find((rule) => rule.dynamicFilter ? selectorWithDynamicFilter(datum, rule.dynamicFilter, rule.selector) : selector_selector(datum, rule.selector)); + if (!rule) return radius; + const barRadius = normalizePadding(rule.barRadius); + return normalizePadding(radius).map((corner, index) => Math.min(corner, barRadius[index])); + } : defaultRadius; + return { + ...spec, + stackCornerRadius: clipRadius + }; + } return { ...spec, bar: { @@ -10492,195 +10693,6 @@ var init_tooltip$3 = __esmMin((() => { init_tooltipSankey(); })); //#endregion -//#region ../vseed/dist/esm/dataSelector/selector.js -function nearlyEqual(a, b, epsilon = 1e-8) { - if (Number.isNaN(a) || Number.isNaN(b)) return false; - if (a === b) return true; - return Math.abs(a - b) <= epsilon; -} -var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; -var init_selector$1 = __esmMin((() => { - init_dist$1(); - init_sandbox(); - init_dataReshape(); - selector_selector = (vchartDatum, selector, selectorMode = "And") => { - if (!selector) return true; - const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); - return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { - if (isValueSelector(selector)) return selectByValue(selector, datum); - else if (isFieldSelector(selector)) return selectByField(selector, datum); - else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); - else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); - else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); - return false; - }); - }; - isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; - isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; - isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); - isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.operator) || [ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.op)); - isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); - selectByMeasure = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "=": - if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "==": - if (datum[selector.field] === selectorValueArr[0]) return true; - break; - case "!=": - if (datum[selector.field] !== selectorValueArr[0]) return true; - break; - case ">": - if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<": - if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case ">=": - if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<=": - if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "between": - if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; - break; - } - return false; - }; - selectByDmension = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "in": - if (selectorValueArr.includes(datum[selector.field])) return true; - break; - case "not in": - if (!selectorValueArr.includes(datum[selector.field])) return true; - break; - } - return false; - }; - selectByField = (selector, datum) => { - const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; - const datumKeys = Object.keys(datum); - return fields.some((field) => datumKeys.includes(field)); - }; - matchesFieldSelector = (field, fieldSelector) => { - return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); - }; - selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); - selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); - matchesCellSelector = (cell, filterRes) => { - if (filterRes["__row_index"] !== cell["__row_index"]) return false; - return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); - }; - matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); - isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; - isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); - isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); - isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); - validateFilterResult = (result, filter) => { - if (isValueDynamicFilter(filter)) { - if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); - return; - } - if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); - if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { - const item = result[i]; - if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); - if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); - if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); - } - }; - executeDynamicFilter = async (filter, allData) => { - try { - const { success, data, error } = await executeFilterCode({ - code: filter.code, - data: allData - }); - if (!success) { - console.warn("[vseed] Dynamic filter execution failed:", error); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error - }; - } - try { - validateFilterResult(data, filter); - } catch (validationError) { - console.error("[vseed] Dynamic filter result validation failed:", validationError); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: validationError instanceof Error ? validationError.message : String(validationError) - }; - } - return { - success, - data - }; - } catch (error) { - const errorMessage = error instanceof Error ? error.message : String(error); - console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: errorMessage - }; - } - }; - matchDynamicFilterResult = (result, datum, selectorType = "table") => { - if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); - if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); - return result.some((item) => matchesDatum(datum, item)); - }; - selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { - if (!selectorConfig) return true; - if (isValueDynamicFilter(selectorConfig)) { - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - } - const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; - if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - }; -})); -//#endregion -//#region ../vseed/dist/esm/dataSelector/index.js -var init_dataSelector$1 = __esmMin((() => { - init_selector$1(); -})); -//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/label/label.js var label_label, generateMeasureValue, generateMeasurePercent, buildLabel$2; var init_label$3 = __esmMin((() => { diff --git a/apps/website/docs/public/storybook/ko-KR/assets/vendor.js b/apps/website/docs/public/storybook/ko-KR/assets/vendor.js index 173d315829..a2db127c02 100644 --- a/apps/website/docs/public/storybook/ko-KR/assets/vendor.js +++ b/apps/website/docs/public/storybook/ko-KR/assets/vendor.js @@ -50363,7 +50363,7 @@ var init_color$6 = __esmMin((() => { var init_type$70 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.24/node_modules/@visactor/vutils/es/padding.js -function normalizePadding(padding) { +function normalizePadding$1(padding) { if (isValidNumber$1(padding)) return [ padding, padding, @@ -97171,7 +97171,7 @@ var init_tag$3 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -98052,7 +98052,7 @@ var init_line$16 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis$1.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -98357,7 +98357,7 @@ var init_line$16 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize$1(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -101898,7 +101898,7 @@ var init_scrollbar$3 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -101910,7 +101910,7 @@ var init_scrollbar$3 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -102182,7 +102182,7 @@ var init_poptip$4 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -106455,7 +106455,7 @@ var init_pager$3 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE$1, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -106557,7 +106557,7 @@ var init_base$20 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator$1.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -106574,7 +106574,7 @@ var init_base$20 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -106790,7 +106790,7 @@ var init_discrete$4 = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator$1.group({ x: 0, @@ -108038,7 +108038,7 @@ var init_title$9 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -109310,7 +109310,7 @@ var init_tooltip$6 = __esmMin((() => { const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure, align } = this.attribute; if (!visible) return void this.hideAll(); autoMeasure && Tooltip$2.measureTooltip(this.attribute), autoCalculatePosition && Tooltip$2.calculateTooltipPosition(this.attribute); - const padding = normalizePadding(this.attribute.padding); + const padding = normalizePadding$1(this.attribute.padding); this._tooltipPanel = this.createOrUpdateChild("tooltip-background", Object.assign({ visible: !0 }, panel), "rect"), this._tooltipTitleContainer = this.createOrUpdateChild("tooltip-title", { visible: !0, x: padding[3], @@ -109405,7 +109405,7 @@ var init_tooltip$6 = __esmMin((() => { return "left" === positionX ? x -= tooltipBoxWidth + offsetX : "center" === positionX ? x -= tooltipBoxWidth / 2 : x += offsetX, "top" === positionY ? y -= tooltipBoxHeight + offsetY : "middle" === positionY ? y -= tooltipBoxHeight / 2 : y += offsetY, x + tooltipBoxWidth > parentBounds.x2 && (x -= tooltipBoxWidth + offsetX), y + tooltipBoxHeight > parentBounds.y2 && (y -= tooltipBoxHeight + offsetY), x < parentBounds.x1 && (x = parentBounds.x1), y < parentBounds.y1 && (y = parentBounds.y1), attribute.x = x, attribute.y = y, attribute; } static measureTooltip(attribute) { - const { content, contentStyle } = attribute, padding = normalizePadding(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); + const { content, contentStyle } = attribute, padding = normalizePadding$1(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); let maxWidth = 0, containerHeight = padding[0] + padding[2], titleMaxHeight = 0; const { value: titleValue, shape: titleShape } = titleAttr, { visible: titleHasShape = !1, symbolType: titleShapeType = "" } = null != titleShape ? titleShape : {}; if (isValid$1(titleValue) && "object" != typeof titleAttr.value.text) { @@ -124115,7 +124115,7 @@ var init_heatmap$2 = __esmMin((() => { } initCellBackgroundMarkStyle() { var _a, _b, _c; - const padding = normalizePadding(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); + const padding = normalizePadding$1(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); this.setMarkStyle(this._backgroundMark, { x: (datum) => { const width = this.getCellSize(this._xAxisHelper); @@ -130876,7 +130876,7 @@ function transformLabelAttributes(label, markerData, markAttributeContext) { return (null == shape ? void 0 : shape.visible) ? labelAttrs.shape = Object.assign({ visible: !0 }, transformToGraphic$1(shape.style)) : labelAttrs.shape = { visible: !1 }, !1 !== labelBackground.visible ? (labelAttrs.panel = Object.assign({ visible: !0, customShape: labelBackground.customShape - }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; + }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding$1(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; } return { visible: !1 }; } @@ -134695,7 +134695,7 @@ var init_style$5 = __esmMin((() => { let panelPadding = null; null != border && border.color && (panelStyle.borderColor = border.color), backgroundColor && (panelStyle.backgroundColor = backgroundColor), panelStyle.boxShadow = shadow ? `${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.spread}px ${shadow.color}` : "initial"; const { radius } = null != border ? border : {}; - return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { + return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding$1(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { panelStyle, panelPadding }; @@ -135019,7 +135019,7 @@ var init_attribute = __esmMin((() => { }; getTooltipAttributes = (actualTooltip, spec, globalFontFamily) => { var _a, _b, _c, _d, _e; - const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { + const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding$1(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { fill: !0, size: null !== (_a = null == shape ? void 0 : shape.size) && void 0 !== _a ? _a : 8, spacing: null !== (_b = null == shape ? void 0 : shape.spacing) && void 0 !== _b ? _b : 6 @@ -156416,7 +156416,7 @@ var init_scrollbar$1 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -156428,7 +156428,7 @@ var init_scrollbar$1 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -156647,7 +156647,7 @@ var init_tag$1 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -156882,7 +156882,7 @@ var init_poptip$1 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -163699,7 +163699,7 @@ var init_line$3 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -164004,7 +164004,7 @@ var init_line$3 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -164572,7 +164572,7 @@ var init_pager$1 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -164674,7 +164674,7 @@ var init_base$1 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -164691,7 +164691,7 @@ var init_base$1 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -164901,7 +164901,7 @@ var init_discrete = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator.group({ x: 0, @@ -166113,7 +166113,7 @@ var init_title$4 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -169074,7 +169074,65 @@ var init_color = __esmMin((() => { var init_type$1 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/padding.js -var init_padding$1 = __esmMin((() => {})); +function normalizePadding(padding) { + if (isValidNumber(padding)) return [ + padding, + padding, + padding, + padding + ]; + if (isArray$1(padding)) { + const length = padding.length; + if (1 === length) { + const paddingValue = padding[0]; + return [ + paddingValue, + paddingValue, + paddingValue, + paddingValue + ]; + } + if (2 === length) { + const [vertical, horizontal] = padding; + return [ + vertical, + horizontal, + vertical, + horizontal + ]; + } + if (3 === length) { + const [top, horizontal, bottom] = padding; + return [ + top, + horizontal, + bottom, + horizontal + ]; + } + if (4 === length) return padding; + } + if (isObject$9(padding)) { + const { top = 0, right = 0, bottom = 0, left = 0 } = padding; + return [ + top, + right, + bottom, + left + ]; + } + return [ + 0, + 0, + 0, + 0 + ]; +} +var init_padding$1 = __esmMin((() => { + init_isValidNumber(); + init_isArray(); + init_isObject(); +})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/time/formatUtils.js var init_formatUtils = __esmMin((() => {})); @@ -283933,4 +283991,4 @@ var init_mocker_runtime = __esmMin((() => { globalThis.__STORYBOOK_MOCKER__ = registerModuleMocker(() => new ModuleMockerInterceptor()); })); //#endregion -export { d$2 as $, init_Color as $t, init_yjs as A, H$2 as An, m$2 as At, date as B, preview_exports as Bn, PivotTableAll as Bt, init_kysely as C, isUndefined$1 as Cn, D$2 as Ct, YMap as D, init_esm$1 as Dn, i$5 as Dt, YArray as E, esm_default as En, r$3 as Et, _enum as F, h$3 as Fn, C$3 as Ft, number as G, init_chunk_6OBW3LSX as Gn, boxplot as Gt, init_schemas as H, init_entry_preview_docs as Hn, ListTableAll as Ht, any$1 as I, init_client as In, init_chunk_3GOCSNFN as It, string as J, init_entry_preview as Jn, init_bin as Jt, object as K, setCustomElementsManifest as Kn, init_boxplot as Kt, array as L, proxyCustomElement as Ln, init_es$1 as Lt, init_v4 as M, createEvent as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, forceUpdate as Nn, i$7 as Nt, applyUpdate as O, StreamLight$1 as On, init_chunk_2T7K3PFL as Ot, init_zod as P, getRenderingRef as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, setup as Qn, Color as Qt, boolean as R, transformTag as Rn, PivotChart as Rt, Kysely as S, init_isUndefined as Sn, y$2 as St, UndoManager as T, isNil as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_argtypes_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, entry_preview_docs_exports as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_argtypes as Wn, init_es$4 as Wt, union as X, init_preload_helper as Xn, init_register$1 as Xt, tuple as Y, __vitePreload as Yn, chartModule as Yt, require_tinycolor as Z, init_runtime as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, pickWithout as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, regressionPolynomial as an, init_chunk_BO3LQZNF as at, init_sql as b, init_isArray as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_logistic as cn, n$2 as ct, init_LikeFilled as d, regressionLinear as dn, e$1 as dt, ecdf as en, init_chunk_BCBB46UE as et, init_dist$2 as f, clamper as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, init_pickWithout as gn, t$1 as gt, init_postgres_adapter as h, init_array$1 as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_regression_polynomial as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, Host as jn, T$2 as jt, encodeStateAsUpdate as k, init_streamLight$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLogistic as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, array$2 as mn, n$3 as mt, init_mocker_runtime as n, init_kde as nn, k$2 as nt, SettingOutlined as o, init_regression_lowess as on, o$2 as ot, init_esm as p, init_clamper as pn, init_chunk_JK3VNB42 as pt, record as q, entry_preview_exports as qn, bin as qt, init_es as r, kde as rn, i$3 as rt, init_SettingOutlined as s, regressionLowess as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_ecdf as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_linear as un, o$3 as ut, DummyDriver as v, init_merge as vn, t$2 as vt, Doc as w, init_isNil as wn, init_chunk_PDQFB3TV as wt, sql as x, isArray$1 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, merge$2 as yn, i$4 as yt, custom as z, init_preview as zn, init_PivotChart as zt }; +export { d$2 as $, init_runtime as $n, normalizePadding as $t, init_yjs as A, StreamLight$1 as An, m$2 as At, date as B, transformTag as Bn, PivotTableAll as Bt, init_kysely as C, isArray$1 as Cn, D$2 as Ct, YMap as D, isNil as Dn, i$5 as Dt, YArray as E, init_isNil as En, r$3 as Et, _enum as F, forceUpdate as Fn, C$3 as Ft, number as G, entry_preview_argtypes_exports as Gn, boxplot as Gt, init_schemas as H, preview_exports as Hn, ListTableAll as Ht, any$1 as I, getRenderingRef as In, init_chunk_3GOCSNFN as It, string as J, setCustomElementsManifest as Jn, init_bin as Jt, object as K, init_entry_preview_argtypes as Kn, init_boxplot as Kt, array as L, h$3 as Ln, init_es$1 as Lt, init_v4 as M, H$2 as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, Host as Nn, i$7 as Nt, applyUpdate as O, esm_default as On, init_chunk_2T7K3PFL as Ot, init_zod as P, createEvent as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, init_preload_helper as Qn, init_padding$1 as Qt, boolean as R, init_client as Rn, PivotChart as Rt, Kysely as S, init_isArray as Sn, y$2 as St, UndoManager as T, isUndefined$1 as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_docs_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, init_preview as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_docs as Wn, init_es$4 as Wt, union as X, init_entry_preview as Xn, init_register$1 as Xt, tuple as Y, entry_preview_exports as Yn, chartModule as Yt, require_tinycolor as Z, __vitePreload as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, init_array$1 as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, kde as an, init_chunk_BO3LQZNF as at, init_sql as b, init_merge as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_lowess as cn, n$2 as ct, init_LikeFilled as d, regressionLogistic as dn, e$1 as dt, Color as en, setup as er, init_chunk_BCBB46UE as et, init_dist$2 as f, init_regression_linear as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, array$2 as gn, t$1 as gt, init_postgres_adapter as h, init_clamper as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_kde as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, init_streamLight$1 as jn, T$2 as jt, encodeStateAsUpdate as k, init_esm$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLowess as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, clamper as mn, n$3 as mt, init_mocker_runtime as n, ecdf as nn, k$2 as nt, SettingOutlined as o, init_regression_polynomial as on, o$2 as ot, init_esm as p, regressionLinear as pn, init_chunk_JK3VNB42 as pt, record as q, init_chunk_6OBW3LSX as qn, bin as qt, init_es as r, init_ecdf as rn, i$3 as rt, init_SettingOutlined as s, regressionPolynomial as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_Color as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_logistic as un, o$3 as ut, DummyDriver as v, init_pickWithout as vn, t$2 as vt, Doc as w, init_isUndefined as wn, init_chunk_PDQFB3TV as wt, sql as x, merge$2 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, pickWithout as yn, i$4 as yt, custom as z, proxyCustomElement as zn, init_PivotChart as zt }; diff --git a/apps/website/docs/public/storybook/vi-VN/assets/iframe.js b/apps/website/docs/public/storybook/vi-VN/assets/iframe.js index 642abb01c0..19c44235be 100644 --- a/apps/website/docs/public/storybook/vi-VN/assets/iframe.js +++ b/apps/website/docs/public/storybook/vi-VN/assets/iframe.js @@ -1,5 +1,5 @@ import { n as __esmMin, o as __toESM, r as __exportAll } from "./rolldown-runtime.js"; -import { $ as d$6, A as init_yjs, An as H$4, At as m$8, B as date, Bn as preview_exports$1, Bt as PivotTableAll, Cn as isUndefined, Ct as D$4, D as YMap, Dn as init_esm$1, Dt as i$9, E as YArray, En as esm_default, Et as r$11, F as _enum, Fn as h$5, Ft as C$6, G as number, Gt as boxplot, Hn as init_entry_preview_docs, Ht as ListTableAll, I as any, In as init_client, J as string, Jn as init_entry_preview, K as object, Kn as setCustomElementsManifest, L as array$1, Ln as proxyCustomElement, Lt as init_es$2, Mn as createEvent, N as v4, Nn as forceUpdate, Nt as i$7, O as applyUpdate, On as StreamLight, P as init_zod, Pn as getRenderingRef, Q as init_dist$1, Qn as setup, Qt as Color, R as boolean, Rn as transformTag, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isNil, U as lazy, Un as entry_preview_argtypes_exports, V as discriminatedUnion, Vn as entry_preview_docs_exports, W as literal, Wn as init_entry_preview_argtypes, Wt as init_es$1, X as union, Xn as init_preload_helper, Y as tuple, Yn as __vitePreload, Yt as chartModule, Z as require_tinycolor, Zn as init_runtime, Zt as init_es, _n as pickWithout, an as regressionPolynomial, ct as n$11, dn as regressionLinear, dt as e$8, en as ecdf, f as init_dist$3, fn as clamper, g as PostgresQueryCompiler, gt as t$14, j as init_dist$2, jn as Host, jt as T$4, k as encodeStateAsUpdate, ln as regressionLogistic, m as PostgresAdapter, mn as array, mt as n$10, nt as k$7, ot as o$9, p as init_esm$2, q as record, qn as entry_preview_exports, qt as bin, rn as kde, rt as i$10, sn as regressionLowess, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as isArray, yn as merge, yt as i$8, z as custom, zn as init_preview$1 } from "./vendor.js"; +import { $ as d$6, $n as init_runtime, $t as normalizePadding, A as init_yjs, An as StreamLight, At as m$8, B as date, Bn as transformTag, Bt as PivotTableAll, Cn as isArray, Ct as D$4, D as YMap, Dn as isNil, Dt as i$9, E as YArray, Et as r$11, F as _enum, Fn as forceUpdate, Ft as C$6, G as number, Gn as entry_preview_argtypes_exports, Gt as boxplot, Hn as preview_exports$1, Ht as ListTableAll, I as any, In as getRenderingRef, J as string, Jn as setCustomElementsManifest, K as object, Kn as init_entry_preview_argtypes, L as array$1, Ln as h$5, Lt as init_es$2, Mn as H$4, N as v4, Nn as Host, Nt as i$7, O as applyUpdate, On as esm_default, P as init_zod, Pn as createEvent, Q as init_dist$1, Qn as init_preload_helper, R as boolean, Rn as init_client, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isUndefined, U as lazy, Un as entry_preview_docs_exports, V as discriminatedUnion, Vn as init_preview$1, W as literal, Wn as init_entry_preview_docs, Wt as init_es$1, X as union, Xn as init_entry_preview, Y as tuple, Yn as entry_preview_exports, Yt as chartModule, Z as require_tinycolor, Zn as __vitePreload, Zt as init_es, an as kde, ct as n$11, dn as regressionLogistic, dt as e$8, en as Color, er as setup, f as init_dist$3, g as PostgresQueryCompiler, gn as array, gt as t$14, j as init_dist$2, jt as T$4, k as encodeStateAsUpdate, kn as init_esm$1, ln as regressionLowess, m as PostgresAdapter, mn as clamper, mt as n$10, nn as ecdf, nt as k$7, ot as o$9, p as init_esm$2, pn as regressionLinear, q as record, qt as bin, rt as i$10, sn as regressionPolynomial, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as merge, yn as pickWithout, yt as i$8, z as custom, zn as proxyCustomElement } from "./vendor.js"; //#region iframe.html?html-proxy&inline-css&index=0.css var init_iframe_html_html_proxy_inline_css_index_0 = __esmMin((() => {})); //#endregion @@ -9397,6 +9397,195 @@ var init_stack$1 = __esmMin((() => { }; })); //#endregion +//#region ../vseed/dist/esm/dataSelector/selector.js +function nearlyEqual(a, b, epsilon = 1e-8) { + if (Number.isNaN(a) || Number.isNaN(b)) return false; + if (a === b) return true; + return Math.abs(a - b) <= epsilon; +} +var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; +var init_selector$1 = __esmMin((() => { + init_dist$1(); + init_sandbox(); + init_dataReshape(); + selector_selector = (vchartDatum, selector, selectorMode = "And") => { + if (!selector) return true; + const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); + return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { + if (isValueSelector(selector)) return selectByValue(selector, datum); + else if (isFieldSelector(selector)) return selectByField(selector, datum); + else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); + else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); + else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); + return false; + }); + }; + isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; + isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; + isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); + isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.operator) || [ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.op)); + isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); + selectByMeasure = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "=": + if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "==": + if (datum[selector.field] === selectorValueArr[0]) return true; + break; + case "!=": + if (datum[selector.field] !== selectorValueArr[0]) return true; + break; + case ">": + if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<": + if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case ">=": + if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<=": + if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "between": + if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; + break; + } + return false; + }; + selectByDmension = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "in": + if (selectorValueArr.includes(datum[selector.field])) return true; + break; + case "not in": + if (!selectorValueArr.includes(datum[selector.field])) return true; + break; + } + return false; + }; + selectByField = (selector, datum) => { + const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; + const datumKeys = Object.keys(datum); + return fields.some((field) => datumKeys.includes(field)); + }; + matchesFieldSelector = (field, fieldSelector) => { + return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); + }; + selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); + selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); + matchesCellSelector = (cell, filterRes) => { + if (filterRes["__row_index"] !== cell["__row_index"]) return false; + return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); + }; + matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); + isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; + isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); + isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); + isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); + validateFilterResult = (result, filter) => { + if (isValueDynamicFilter(filter)) { + if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); + return; + } + if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); + if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { + const item = result[i]; + if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); + if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); + if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); + } + }; + executeDynamicFilter = async (filter, allData) => { + try { + const { success, data, error } = await executeFilterCode({ + code: filter.code, + data: allData + }); + if (!success) { + console.warn("[vseed] Dynamic filter execution failed:", error); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error + }; + } + try { + validateFilterResult(data, filter); + } catch (validationError) { + console.error("[vseed] Dynamic filter result validation failed:", validationError); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: validationError instanceof Error ? validationError.message : String(validationError) + }; + } + return { + success, + data + }; + } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: errorMessage + }; + } + }; + matchDynamicFilterResult = (result, datum, selectorType = "table") => { + if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); + if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); + return result.some((item) => matchesDatum(datum, item)); + }; + selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { + if (!selectorConfig) return true; + if (isValueDynamicFilter(selectorConfig)) { + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + } + const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; + if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + }; +})); +//#endregion +//#region ../vseed/dist/esm/dataSelector/index.js +var init_dataSelector$1 = __esmMin((() => { + init_selector$1(); +})); +//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.js var reverseStackCornerRadius, mergeStackCornerRadius, getStackRangeCornerRadius, callbacks, createCornerRadius, createStackCornerRadius, createBarCornerRadius, hasMoveInAnimation; var init_stackCornerRadiusUtils = __esmMin((() => { @@ -9468,6 +9657,8 @@ var init_stackCornerRadiusUtils = __esmMin((() => { //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js var hasBarMoveInAnimation, stackCornerRadius_stackCornerRadius; var init_stackCornerRadius$2 = __esmMin((() => { + init_es(); + init_dataSelector$1(); init_stackCornerRadiusUtils(); hasBarMoveInAnimation = (spec) => [ spec.animationAppear, @@ -9478,13 +9669,23 @@ var init_stackCornerRadius$2 = __esmMin((() => { stackCornerRadius_stackCornerRadius = (spec, context) => { const { advancedVSeed, vseed } = context; const { chartType } = vseed; - const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius; - const styles = advancedVSeed.markStyle?.barStyle; - if (null == stackCornerRadius || (Array.isArray(styles) ? styles : styles ? [styles] : []).some((rule) => null != rule.barRadius)) return spec; - if (!(advancedVSeed.datasetReshapeInfo?.[0]?.unfoldInfo.colorItems.length === 1) && !hasBarMoveInAnimation(spec)) return { - ...spec, - stackCornerRadius: createStackCornerRadius(stackCornerRadius) - }; + const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius ?? 0; + if (!hasBarMoveInAnimation(spec)) { + const styles = advancedVSeed.markStyle?.barStyle; + const rules = (Array.isArray(styles) ? styles : styles ? [styles] : []).filter((rule) => null != rule.barRadius).reverse(); + const defaultRadius = createStackCornerRadius(stackCornerRadius); + const clipRadius = rules.length ? (attributes, datum) => { + const radius = defaultRadius(attributes, datum); + const rule = rules.find((rule) => rule.dynamicFilter ? selectorWithDynamicFilter(datum, rule.dynamicFilter, rule.selector) : selector_selector(datum, rule.selector)); + if (!rule) return radius; + const barRadius = normalizePadding(rule.barRadius); + return normalizePadding(radius).map((corner, index) => Math.min(corner, barRadius[index])); + } : defaultRadius; + return { + ...spec, + stackCornerRadius: clipRadius + }; + } return { ...spec, bar: { @@ -10492,195 +10693,6 @@ var init_tooltip$3 = __esmMin((() => { init_tooltipSankey(); })); //#endregion -//#region ../vseed/dist/esm/dataSelector/selector.js -function nearlyEqual(a, b, epsilon = 1e-8) { - if (Number.isNaN(a) || Number.isNaN(b)) return false; - if (a === b) return true; - return Math.abs(a - b) <= epsilon; -} -var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; -var init_selector$1 = __esmMin((() => { - init_dist$1(); - init_sandbox(); - init_dataReshape(); - selector_selector = (vchartDatum, selector, selectorMode = "And") => { - if (!selector) return true; - const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); - return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { - if (isValueSelector(selector)) return selectByValue(selector, datum); - else if (isFieldSelector(selector)) return selectByField(selector, datum); - else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); - else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); - else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); - return false; - }); - }; - isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; - isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; - isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); - isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.operator) || [ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.op)); - isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); - selectByMeasure = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "=": - if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "==": - if (datum[selector.field] === selectorValueArr[0]) return true; - break; - case "!=": - if (datum[selector.field] !== selectorValueArr[0]) return true; - break; - case ">": - if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<": - if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case ">=": - if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<=": - if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "between": - if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; - break; - } - return false; - }; - selectByDmension = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "in": - if (selectorValueArr.includes(datum[selector.field])) return true; - break; - case "not in": - if (!selectorValueArr.includes(datum[selector.field])) return true; - break; - } - return false; - }; - selectByField = (selector, datum) => { - const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; - const datumKeys = Object.keys(datum); - return fields.some((field) => datumKeys.includes(field)); - }; - matchesFieldSelector = (field, fieldSelector) => { - return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); - }; - selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); - selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); - matchesCellSelector = (cell, filterRes) => { - if (filterRes["__row_index"] !== cell["__row_index"]) return false; - return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); - }; - matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); - isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; - isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); - isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); - isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); - validateFilterResult = (result, filter) => { - if (isValueDynamicFilter(filter)) { - if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); - return; - } - if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); - if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { - const item = result[i]; - if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); - if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); - if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); - } - }; - executeDynamicFilter = async (filter, allData) => { - try { - const { success, data, error } = await executeFilterCode({ - code: filter.code, - data: allData - }); - if (!success) { - console.warn("[vseed] Dynamic filter execution failed:", error); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error - }; - } - try { - validateFilterResult(data, filter); - } catch (validationError) { - console.error("[vseed] Dynamic filter result validation failed:", validationError); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: validationError instanceof Error ? validationError.message : String(validationError) - }; - } - return { - success, - data - }; - } catch (error) { - const errorMessage = error instanceof Error ? error.message : String(error); - console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: errorMessage - }; - } - }; - matchDynamicFilterResult = (result, datum, selectorType = "table") => { - if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); - if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); - return result.some((item) => matchesDatum(datum, item)); - }; - selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { - if (!selectorConfig) return true; - if (isValueDynamicFilter(selectorConfig)) { - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - } - const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; - if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - }; -})); -//#endregion -//#region ../vseed/dist/esm/dataSelector/index.js -var init_dataSelector$1 = __esmMin((() => { - init_selector$1(); -})); -//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/label/label.js var label_label, generateMeasureValue, generateMeasurePercent, buildLabel$2; var init_label$3 = __esmMin((() => { diff --git a/apps/website/docs/public/storybook/vi-VN/assets/vendor.js b/apps/website/docs/public/storybook/vi-VN/assets/vendor.js index 173d315829..a2db127c02 100644 --- a/apps/website/docs/public/storybook/vi-VN/assets/vendor.js +++ b/apps/website/docs/public/storybook/vi-VN/assets/vendor.js @@ -50363,7 +50363,7 @@ var init_color$6 = __esmMin((() => { var init_type$70 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.24/node_modules/@visactor/vutils/es/padding.js -function normalizePadding(padding) { +function normalizePadding$1(padding) { if (isValidNumber$1(padding)) return [ padding, padding, @@ -97171,7 +97171,7 @@ var init_tag$3 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -98052,7 +98052,7 @@ var init_line$16 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis$1.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -98357,7 +98357,7 @@ var init_line$16 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize$1(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -101898,7 +101898,7 @@ var init_scrollbar$3 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -101910,7 +101910,7 @@ var init_scrollbar$3 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -102182,7 +102182,7 @@ var init_poptip$4 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -106455,7 +106455,7 @@ var init_pager$3 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE$1, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -106557,7 +106557,7 @@ var init_base$20 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator$1.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -106574,7 +106574,7 @@ var init_base$20 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -106790,7 +106790,7 @@ var init_discrete$4 = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator$1.group({ x: 0, @@ -108038,7 +108038,7 @@ var init_title$9 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -109310,7 +109310,7 @@ var init_tooltip$6 = __esmMin((() => { const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure, align } = this.attribute; if (!visible) return void this.hideAll(); autoMeasure && Tooltip$2.measureTooltip(this.attribute), autoCalculatePosition && Tooltip$2.calculateTooltipPosition(this.attribute); - const padding = normalizePadding(this.attribute.padding); + const padding = normalizePadding$1(this.attribute.padding); this._tooltipPanel = this.createOrUpdateChild("tooltip-background", Object.assign({ visible: !0 }, panel), "rect"), this._tooltipTitleContainer = this.createOrUpdateChild("tooltip-title", { visible: !0, x: padding[3], @@ -109405,7 +109405,7 @@ var init_tooltip$6 = __esmMin((() => { return "left" === positionX ? x -= tooltipBoxWidth + offsetX : "center" === positionX ? x -= tooltipBoxWidth / 2 : x += offsetX, "top" === positionY ? y -= tooltipBoxHeight + offsetY : "middle" === positionY ? y -= tooltipBoxHeight / 2 : y += offsetY, x + tooltipBoxWidth > parentBounds.x2 && (x -= tooltipBoxWidth + offsetX), y + tooltipBoxHeight > parentBounds.y2 && (y -= tooltipBoxHeight + offsetY), x < parentBounds.x1 && (x = parentBounds.x1), y < parentBounds.y1 && (y = parentBounds.y1), attribute.x = x, attribute.y = y, attribute; } static measureTooltip(attribute) { - const { content, contentStyle } = attribute, padding = normalizePadding(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); + const { content, contentStyle } = attribute, padding = normalizePadding$1(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); let maxWidth = 0, containerHeight = padding[0] + padding[2], titleMaxHeight = 0; const { value: titleValue, shape: titleShape } = titleAttr, { visible: titleHasShape = !1, symbolType: titleShapeType = "" } = null != titleShape ? titleShape : {}; if (isValid$1(titleValue) && "object" != typeof titleAttr.value.text) { @@ -124115,7 +124115,7 @@ var init_heatmap$2 = __esmMin((() => { } initCellBackgroundMarkStyle() { var _a, _b, _c; - const padding = normalizePadding(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); + const padding = normalizePadding$1(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); this.setMarkStyle(this._backgroundMark, { x: (datum) => { const width = this.getCellSize(this._xAxisHelper); @@ -130876,7 +130876,7 @@ function transformLabelAttributes(label, markerData, markAttributeContext) { return (null == shape ? void 0 : shape.visible) ? labelAttrs.shape = Object.assign({ visible: !0 }, transformToGraphic$1(shape.style)) : labelAttrs.shape = { visible: !1 }, !1 !== labelBackground.visible ? (labelAttrs.panel = Object.assign({ visible: !0, customShape: labelBackground.customShape - }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; + }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding$1(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; } return { visible: !1 }; } @@ -134695,7 +134695,7 @@ var init_style$5 = __esmMin((() => { let panelPadding = null; null != border && border.color && (panelStyle.borderColor = border.color), backgroundColor && (panelStyle.backgroundColor = backgroundColor), panelStyle.boxShadow = shadow ? `${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.spread}px ${shadow.color}` : "initial"; const { radius } = null != border ? border : {}; - return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { + return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding$1(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { panelStyle, panelPadding }; @@ -135019,7 +135019,7 @@ var init_attribute = __esmMin((() => { }; getTooltipAttributes = (actualTooltip, spec, globalFontFamily) => { var _a, _b, _c, _d, _e; - const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { + const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding$1(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { fill: !0, size: null !== (_a = null == shape ? void 0 : shape.size) && void 0 !== _a ? _a : 8, spacing: null !== (_b = null == shape ? void 0 : shape.spacing) && void 0 !== _b ? _b : 6 @@ -156416,7 +156416,7 @@ var init_scrollbar$1 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -156428,7 +156428,7 @@ var init_scrollbar$1 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -156647,7 +156647,7 @@ var init_tag$1 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -156882,7 +156882,7 @@ var init_poptip$1 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -163699,7 +163699,7 @@ var init_line$3 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -164004,7 +164004,7 @@ var init_line$3 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -164572,7 +164572,7 @@ var init_pager$1 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -164674,7 +164674,7 @@ var init_base$1 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -164691,7 +164691,7 @@ var init_base$1 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -164901,7 +164901,7 @@ var init_discrete = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator.group({ x: 0, @@ -166113,7 +166113,7 @@ var init_title$4 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -169074,7 +169074,65 @@ var init_color = __esmMin((() => { var init_type$1 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/padding.js -var init_padding$1 = __esmMin((() => {})); +function normalizePadding(padding) { + if (isValidNumber(padding)) return [ + padding, + padding, + padding, + padding + ]; + if (isArray$1(padding)) { + const length = padding.length; + if (1 === length) { + const paddingValue = padding[0]; + return [ + paddingValue, + paddingValue, + paddingValue, + paddingValue + ]; + } + if (2 === length) { + const [vertical, horizontal] = padding; + return [ + vertical, + horizontal, + vertical, + horizontal + ]; + } + if (3 === length) { + const [top, horizontal, bottom] = padding; + return [ + top, + horizontal, + bottom, + horizontal + ]; + } + if (4 === length) return padding; + } + if (isObject$9(padding)) { + const { top = 0, right = 0, bottom = 0, left = 0 } = padding; + return [ + top, + right, + bottom, + left + ]; + } + return [ + 0, + 0, + 0, + 0 + ]; +} +var init_padding$1 = __esmMin((() => { + init_isValidNumber(); + init_isArray(); + init_isObject(); +})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/time/formatUtils.js var init_formatUtils = __esmMin((() => {})); @@ -283933,4 +283991,4 @@ var init_mocker_runtime = __esmMin((() => { globalThis.__STORYBOOK_MOCKER__ = registerModuleMocker(() => new ModuleMockerInterceptor()); })); //#endregion -export { d$2 as $, init_Color as $t, init_yjs as A, H$2 as An, m$2 as At, date as B, preview_exports as Bn, PivotTableAll as Bt, init_kysely as C, isUndefined$1 as Cn, D$2 as Ct, YMap as D, init_esm$1 as Dn, i$5 as Dt, YArray as E, esm_default as En, r$3 as Et, _enum as F, h$3 as Fn, C$3 as Ft, number as G, init_chunk_6OBW3LSX as Gn, boxplot as Gt, init_schemas as H, init_entry_preview_docs as Hn, ListTableAll as Ht, any$1 as I, init_client as In, init_chunk_3GOCSNFN as It, string as J, init_entry_preview as Jn, init_bin as Jt, object as K, setCustomElementsManifest as Kn, init_boxplot as Kt, array as L, proxyCustomElement as Ln, init_es$1 as Lt, init_v4 as M, createEvent as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, forceUpdate as Nn, i$7 as Nt, applyUpdate as O, StreamLight$1 as On, init_chunk_2T7K3PFL as Ot, init_zod as P, getRenderingRef as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, setup as Qn, Color as Qt, boolean as R, transformTag as Rn, PivotChart as Rt, Kysely as S, init_isUndefined as Sn, y$2 as St, UndoManager as T, isNil as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_argtypes_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, entry_preview_docs_exports as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_argtypes as Wn, init_es$4 as Wt, union as X, init_preload_helper as Xn, init_register$1 as Xt, tuple as Y, __vitePreload as Yn, chartModule as Yt, require_tinycolor as Z, init_runtime as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, pickWithout as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, regressionPolynomial as an, init_chunk_BO3LQZNF as at, init_sql as b, init_isArray as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_logistic as cn, n$2 as ct, init_LikeFilled as d, regressionLinear as dn, e$1 as dt, ecdf as en, init_chunk_BCBB46UE as et, init_dist$2 as f, clamper as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, init_pickWithout as gn, t$1 as gt, init_postgres_adapter as h, init_array$1 as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_regression_polynomial as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, Host as jn, T$2 as jt, encodeStateAsUpdate as k, init_streamLight$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLogistic as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, array$2 as mn, n$3 as mt, init_mocker_runtime as n, init_kde as nn, k$2 as nt, SettingOutlined as o, init_regression_lowess as on, o$2 as ot, init_esm as p, init_clamper as pn, init_chunk_JK3VNB42 as pt, record as q, entry_preview_exports as qn, bin as qt, init_es as r, kde as rn, i$3 as rt, init_SettingOutlined as s, regressionLowess as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_ecdf as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_linear as un, o$3 as ut, DummyDriver as v, init_merge as vn, t$2 as vt, Doc as w, init_isNil as wn, init_chunk_PDQFB3TV as wt, sql as x, isArray$1 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, merge$2 as yn, i$4 as yt, custom as z, init_preview as zn, init_PivotChart as zt }; +export { d$2 as $, init_runtime as $n, normalizePadding as $t, init_yjs as A, StreamLight$1 as An, m$2 as At, date as B, transformTag as Bn, PivotTableAll as Bt, init_kysely as C, isArray$1 as Cn, D$2 as Ct, YMap as D, isNil as Dn, i$5 as Dt, YArray as E, init_isNil as En, r$3 as Et, _enum as F, forceUpdate as Fn, C$3 as Ft, number as G, entry_preview_argtypes_exports as Gn, boxplot as Gt, init_schemas as H, preview_exports as Hn, ListTableAll as Ht, any$1 as I, getRenderingRef as In, init_chunk_3GOCSNFN as It, string as J, setCustomElementsManifest as Jn, init_bin as Jt, object as K, init_entry_preview_argtypes as Kn, init_boxplot as Kt, array as L, h$3 as Ln, init_es$1 as Lt, init_v4 as M, H$2 as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, Host as Nn, i$7 as Nt, applyUpdate as O, esm_default as On, init_chunk_2T7K3PFL as Ot, init_zod as P, createEvent as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, init_preload_helper as Qn, init_padding$1 as Qt, boolean as R, init_client as Rn, PivotChart as Rt, Kysely as S, init_isArray as Sn, y$2 as St, UndoManager as T, isUndefined$1 as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_docs_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, init_preview as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_docs as Wn, init_es$4 as Wt, union as X, init_entry_preview as Xn, init_register$1 as Xt, tuple as Y, entry_preview_exports as Yn, chartModule as Yt, require_tinycolor as Z, __vitePreload as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, init_array$1 as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, kde as an, init_chunk_BO3LQZNF as at, init_sql as b, init_merge as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_lowess as cn, n$2 as ct, init_LikeFilled as d, regressionLogistic as dn, e$1 as dt, Color as en, setup as er, init_chunk_BCBB46UE as et, init_dist$2 as f, init_regression_linear as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, array$2 as gn, t$1 as gt, init_postgres_adapter as h, init_clamper as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_kde as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, init_streamLight$1 as jn, T$2 as jt, encodeStateAsUpdate as k, init_esm$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLowess as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, clamper as mn, n$3 as mt, init_mocker_runtime as n, ecdf as nn, k$2 as nt, SettingOutlined as o, init_regression_polynomial as on, o$2 as ot, init_esm as p, regressionLinear as pn, init_chunk_JK3VNB42 as pt, record as q, init_chunk_6OBW3LSX as qn, bin as qt, init_es as r, init_ecdf as rn, i$3 as rt, init_SettingOutlined as s, regressionPolynomial as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_Color as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_logistic as un, o$3 as ut, DummyDriver as v, init_pickWithout as vn, t$2 as vt, Doc as w, init_isUndefined as wn, init_chunk_PDQFB3TV as wt, sql as x, merge$2 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, pickWithout as yn, i$4 as yt, custom as z, proxyCustomElement as zn, init_PivotChart as zt }; diff --git a/apps/website/docs/public/storybook/zh-CN/assets/iframe.js b/apps/website/docs/public/storybook/zh-CN/assets/iframe.js index 7e70b54b52..605b50173e 100644 --- a/apps/website/docs/public/storybook/zh-CN/assets/iframe.js +++ b/apps/website/docs/public/storybook/zh-CN/assets/iframe.js @@ -1,5 +1,5 @@ import { n as __esmMin, o as __toESM, r as __exportAll } from "./rolldown-runtime.js"; -import { $ as d$6, A as init_yjs, An as H$4, At as m$8, B as date, Bn as preview_exports$1, Bt as PivotTableAll, Cn as isUndefined, Ct as D$4, D as YMap, Dn as init_esm$1, Dt as i$9, E as YArray, En as esm_default, Et as r$11, F as _enum, Fn as h$5, Ft as C$6, G as number, Gt as boxplot, Hn as init_entry_preview_docs, Ht as ListTableAll, I as any, In as init_client, J as string, Jn as init_entry_preview, K as object, Kn as setCustomElementsManifest, L as array$1, Ln as proxyCustomElement, Lt as init_es$2, Mn as createEvent, N as v4, Nn as forceUpdate, Nt as i$7, O as applyUpdate, On as StreamLight, P as init_zod, Pn as getRenderingRef, Q as init_dist$1, Qn as setup, Qt as Color, R as boolean, Rn as transformTag, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isNil, U as lazy, Un as entry_preview_argtypes_exports, V as discriminatedUnion, Vn as entry_preview_docs_exports, W as literal, Wn as init_entry_preview_argtypes, Wt as init_es$1, X as union, Xn as init_preload_helper, Y as tuple, Yn as __vitePreload, Yt as chartModule, Z as require_tinycolor, Zn as init_runtime, Zt as init_es, _n as pickWithout, an as regressionPolynomial, ct as n$11, dn as regressionLinear, dt as e$8, en as ecdf, f as init_dist$3, fn as clamper, g as PostgresQueryCompiler, gt as t$14, j as init_dist$2, jn as Host, jt as T$4, k as encodeStateAsUpdate, ln as regressionLogistic, m as PostgresAdapter, mn as array, mt as n$10, nt as k$7, ot as o$9, p as init_esm$2, q as record, qn as entry_preview_exports, qt as bin, rn as kde, rt as i$10, sn as regressionLowess, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as isArray, yn as merge, yt as i$8, z as custom, zn as init_preview$1 } from "./vendor.js"; +import { $ as d$6, $n as init_runtime, $t as normalizePadding, A as init_yjs, An as StreamLight, At as m$8, B as date, Bn as transformTag, Bt as PivotTableAll, Cn as isArray, Ct as D$4, D as YMap, Dn as isNil, Dt as i$9, E as YArray, Et as r$11, F as _enum, Fn as forceUpdate, Ft as C$6, G as number, Gn as entry_preview_argtypes_exports, Gt as boxplot, Hn as preview_exports$1, Ht as ListTableAll, I as any, In as getRenderingRef, J as string, Jn as setCustomElementsManifest, K as object, Kn as init_entry_preview_argtypes, L as array$1, Ln as h$5, Lt as init_es$2, Mn as H$4, N as v4, Nn as Host, Nt as i$7, O as applyUpdate, On as esm_default, P as init_zod, Pn as createEvent, Q as init_dist$1, Qn as init_preload_helper, R as boolean, Rn as init_client, Rt as PivotChart, S as Kysely, St as y$10, T as UndoManager$1, Tn as isUndefined, U as lazy, Un as entry_preview_docs_exports, V as discriminatedUnion, Vn as init_preview$1, W as literal, Wn as init_entry_preview_docs, Wt as init_es$1, X as union, Xn as init_entry_preview, Y as tuple, Yn as entry_preview_exports, Yt as chartModule, Z as require_tinycolor, Zn as __vitePreload, Zt as init_es, an as kde, ct as n$11, dn as regressionLogistic, dt as e$8, en as Color, er as setup, f as init_dist$3, g as PostgresQueryCompiler, gn as array, gt as t$14, j as init_dist$2, jt as T$4, k as encodeStateAsUpdate, kn as init_esm$1, ln as regressionLowess, m as PostgresAdapter, mn as clamper, mt as n$10, nn as ecdf, nt as k$7, ot as o$9, p as init_esm$2, pn as regressionLinear, q as record, qt as bin, rt as i$10, sn as regressionPolynomial, ut as o$10, v as DummyDriver, vt as t$13, w as Doc, x as sql, xn as merge, yn as pickWithout, yt as i$8, z as custom, zn as proxyCustomElement } from "./vendor.js"; //#region iframe.html?html-proxy&inline-css&index=0.css var init_iframe_html_html_proxy_inline_css_index_0 = __esmMin((() => {})); //#endregion @@ -9397,6 +9397,195 @@ var init_stack$1 = __esmMin((() => { }; })); //#endregion +//#region ../vseed/dist/esm/dataSelector/selector.js +function nearlyEqual(a, b, epsilon = 1e-8) { + if (Number.isNaN(a) || Number.isNaN(b)) return false; + if (a === b) return true; + return Math.abs(a - b) <= epsilon; +} +var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; +var init_selector$1 = __esmMin((() => { + init_dist$1(); + init_sandbox(); + init_dataReshape(); + selector_selector = (vchartDatum, selector, selectorMode = "And") => { + if (!selector) return true; + const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); + return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { + if (isValueSelector(selector)) return selectByValue(selector, datum); + else if (isFieldSelector(selector)) return selectByField(selector, datum); + else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); + else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); + else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); + return false; + }); + }; + isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; + isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; + isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); + isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.operator) || [ + "=", + "==", + "!=", + ">", + "<", + ">=", + "<=", + "between" + ].includes(selector.op)); + isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); + selectByMeasure = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "=": + if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "==": + if (datum[selector.field] === selectorValueArr[0]) return true; + break; + case "!=": + if (datum[selector.field] !== selectorValueArr[0]) return true; + break; + case ">": + if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<": + if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case ">=": + if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "<=": + if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; + break; + case "between": + if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; + break; + } + return false; + }; + selectByDmension = (selector, datum) => { + const op = selector.operator || selector.op; + const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; + switch (op) { + case "in": + if (selectorValueArr.includes(datum[selector.field])) return true; + break; + case "not in": + if (!selectorValueArr.includes(datum[selector.field])) return true; + break; + } + return false; + }; + selectByField = (selector, datum) => { + const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; + const datumKeys = Object.keys(datum); + return fields.some((field) => datumKeys.includes(field)); + }; + matchesFieldSelector = (field, fieldSelector) => { + return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); + }; + selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); + selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); + matchesCellSelector = (cell, filterRes) => { + if (filterRes["__row_index"] !== cell["__row_index"]) return false; + return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); + }; + matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); + isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; + isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); + isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); + isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); + validateFilterResult = (result, filter) => { + if (isValueDynamicFilter(filter)) { + if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); + return; + } + if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); + if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { + const item = result[i]; + if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); + if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); + if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); + } + }; + executeDynamicFilter = async (filter, allData) => { + try { + const { success, data, error } = await executeFilterCode({ + code: filter.code, + data: allData + }); + if (!success) { + console.warn("[vseed] Dynamic filter execution failed:", error); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error + }; + } + try { + validateFilterResult(data, filter); + } catch (validationError) { + console.error("[vseed] Dynamic filter result validation failed:", validationError); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: validationError instanceof Error ? validationError.message : String(validationError) + }; + } + return { + success, + data + }; + } catch (error) { + const errorMessage = error instanceof Error ? error.message : String(error); + console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); + return { + success: false, + data: isRowWithFieldDynamicFilter(filter) ? [] : "", + error: errorMessage + }; + } + }; + matchDynamicFilterResult = (result, datum, selectorType = "table") => { + if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); + if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); + return result.some((item) => matchesDatum(datum, item)); + }; + selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { + if (!selectorConfig) return true; + if (isValueDynamicFilter(selectorConfig)) { + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + } + const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; + if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); + if (selectorConfig.fallback) { + const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; + return selector_selector(vchartDatum, fallbackSelector); + } + return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; + }; +})); +//#endregion +//#region ../vseed/dist/esm/dataSelector/index.js +var init_dataSelector$1 = __esmMin((() => { + init_selector$1(); +})); +//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadiusUtils.js var reverseStackCornerRadius, mergeStackCornerRadius, getStackRangeCornerRadius, callbacks, createCornerRadius, createStackCornerRadius, createBarCornerRadius, hasMoveInAnimation; var init_stackCornerRadiusUtils = __esmMin((() => { @@ -9468,6 +9657,8 @@ var init_stackCornerRadiusUtils = __esmMin((() => { //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/stack/stackCornerRadius.js var hasBarMoveInAnimation, stackCornerRadius_stackCornerRadius; var init_stackCornerRadius$2 = __esmMin((() => { + init_es(); + init_dataSelector$1(); init_stackCornerRadiusUtils(); hasBarMoveInAnimation = (spec) => [ spec.animationAppear, @@ -9478,13 +9669,23 @@ var init_stackCornerRadius$2 = __esmMin((() => { stackCornerRadius_stackCornerRadius = (spec, context) => { const { advancedVSeed, vseed } = context; const { chartType } = vseed; - const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius; - const styles = advancedVSeed.markStyle?.barStyle; - if (null == stackCornerRadius || (Array.isArray(styles) ? styles : styles ? [styles] : []).some((rule) => null != rule.barRadius)) return spec; - if (!(advancedVSeed.datasetReshapeInfo?.[0]?.unfoldInfo.colorItems.length === 1) && !hasBarMoveInAnimation(spec)) return { - ...spec, - stackCornerRadius: createStackCornerRadius(stackCornerRadius) - }; + const stackCornerRadius = advancedVSeed.config?.[chartType]?.stackCornerRadius ?? 0; + if (!hasBarMoveInAnimation(spec)) { + const styles = advancedVSeed.markStyle?.barStyle; + const rules = (Array.isArray(styles) ? styles : styles ? [styles] : []).filter((rule) => null != rule.barRadius).reverse(); + const defaultRadius = createStackCornerRadius(stackCornerRadius); + const clipRadius = rules.length ? (attributes, datum) => { + const radius = defaultRadius(attributes, datum); + const rule = rules.find((rule) => rule.dynamicFilter ? selectorWithDynamicFilter(datum, rule.dynamicFilter, rule.selector) : selector_selector(datum, rule.selector)); + if (!rule) return radius; + const barRadius = normalizePadding(rule.barRadius); + return normalizePadding(radius).map((corner, index) => Math.min(corner, barRadius[index])); + } : defaultRadius; + return { + ...spec, + stackCornerRadius: clipRadius + }; + } return { ...spec, bar: { @@ -10492,195 +10693,6 @@ var init_tooltip$3 = __esmMin((() => { init_tooltipSankey(); })); //#endregion -//#region ../vseed/dist/esm/dataSelector/selector.js -function nearlyEqual(a, b, epsilon = 1e-8) { - if (Number.isNaN(a) || Number.isNaN(b)) return false; - if (a === b) return true; - return Math.abs(a - b) <= epsilon; -} -var selector_selector, isValueSelector, isPartialDatumSelector, isFieldSelector, isMeasureSelector, isDimensionSelector, selectByMeasure, selectByDmension, selectByField, matchesFieldSelector, selectByPartial, selectByValue, matchesCellSelector, matchesDatum, isDynamicFilterLike, isRowWithFieldDynamicFilter, isValueDynamicFilter, isDynamicFilter, validateFilterResult, executeDynamicFilter, matchDynamicFilterResult, selectorWithDynamicFilter; -var init_selector$1 = __esmMin((() => { - init_dist$1(); - init_sandbox(); - init_dataReshape(); - selector_selector = (vchartDatum, selector, selectorMode = "And") => { - if (!selector) return true; - const datum = y$10(vchartDatum, Object.keys(vchartDatum).filter((k) => k.toLocaleLowerCase().startsWith("__vchart"))); - return (Array.isArray(selector) ? selector : [selector])["And" === selectorMode ? "every" : "some"]((selector) => { - if (isValueSelector(selector)) return selectByValue(selector, datum); - else if (isFieldSelector(selector)) return selectByField(selector, datum); - else if (isMeasureSelector(selector)) return selectByMeasure(selector, datum); - else if (isDimensionSelector(selector)) return selectByDmension(selector, datum); - else if (isPartialDatumSelector(selector)) return selectByPartial(selector, datum); - return false; - }); - }; - isValueSelector = (selector) => "string" == typeof selector || "number" == typeof selector; - isPartialDatumSelector = (selector) => "object" == typeof selector && null !== selector; - isFieldSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && !("operator" in selector) && !("op" in selector) && !("value" in selector); - isMeasureSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && ([ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.operator) || [ - "=", - "==", - "!=", - ">", - "<", - ">=", - "<=", - "between" - ].includes(selector.op)); - isDimensionSelector = (selector) => "object" == typeof selector && null !== selector && "field" in selector && ("operator" in selector || "op" in selector) && "value" in selector && (["in", "not in"].includes(selector.operator) || ["in", "not in"].includes(selector.op)); - selectByMeasure = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "=": - if (String(datum[selector.field]) === String(selectorValueArr[0]) || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "==": - if (datum[selector.field] === selectorValueArr[0]) return true; - break; - case "!=": - if (datum[selector.field] !== selectorValueArr[0]) return true; - break; - case ">": - if (datum[selector.field] > selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<": - if (datum[selector.field] < selectorValueArr[0] && !nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case ">=": - if (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "<=": - if (datum[selector.field] <= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) return true; - break; - case "between": - if (Array.isArray(selector.value) && (datum[selector.field] >= selectorValueArr[0] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[0]))) && (datum[selector.field] <= selectorValueArr[1] || nearlyEqual(Number(datum[selector.field]), Number(selectorValueArr[1])))) return true; - break; - } - return false; - }; - selectByDmension = (selector, datum) => { - const op = selector.operator || selector.op; - const selectorValueArr = Array.isArray(selector.value) ? selector.value : [selector.value]; - switch (op) { - case "in": - if (selectorValueArr.includes(datum[selector.field])) return true; - break; - case "not in": - if (!selectorValueArr.includes(datum[selector.field])) return true; - break; - } - return false; - }; - selectByField = (selector, datum) => { - const fields = Array.isArray(selector.field) ? selector.field : [selector.field]; - const datumKeys = Object.keys(datum); - return fields.some((field) => datumKeys.includes(field)); - }; - matchesFieldSelector = (field, fieldSelector) => { - return (Array.isArray(fieldSelector.field) ? fieldSelector.field : [fieldSelector.field]).includes(field); - }; - selectByPartial = (selector, datum) => Object.keys(selector).every((key) => datum[key] === selector[key]); - selectByValue = (selector, datum) => Object.values(datum).some((v) => v === selector); - matchesCellSelector = (cell, filterRes) => { - if (filterRes["__row_index"] !== cell["__row_index"]) return false; - return "*" === filterRes.field || Object.keys(cell).includes(filterRes.field); - }; - matchesDatum = (target, candidate) => Object.keys(candidate).every((key) => target[key] === candidate[key]); - isDynamicFilterLike = (selector, expectedTypes) => "object" == typeof selector && null !== selector && "type" in selector && expectedTypes.includes(selector.type) && "code" in selector && "string" == typeof selector.code; - isRowWithFieldDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field"]); - isValueDynamicFilter = (selector) => isDynamicFilterLike(selector, ["value"]); - isDynamicFilter = (selector) => isDynamicFilterLike(selector, ["row-with-field", "value"]); - validateFilterResult = (result, filter) => { - if (isValueDynamicFilter(filter)) { - if ("number" != typeof result && "string" != typeof result) throw new TypeError(`ValueDynamicFilter must return a number or string, but got: ${typeof result}. Code: "${filter.code}"`); - return; - } - if (!Array.isArray(result)) throw new TypeError(`${isRowWithFieldDynamicFilter(filter) ? "TableDynamicFilter" : "ChartDynamicFilter"} must return an array, but got: ${typeof result}. Code: "${filter.code}"`); - if (isRowWithFieldDynamicFilter(filter)) for (let i = 0; i < result.length; i++) { - const item = result[i]; - if ("object" != typeof item || null === item) throw new TypeError(`TableDynamicFilter array element at index ${i} must be an object, got: ${typeof item}`); - if (!("__row_index" in item) && "__row_index" in item === false) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain __row_index or InnerRowIndex field`); - if (!("field" in item)) throw new TypeError(`TableDynamicFilter array element at index ${i} must contain 'field' field`); - } - }; - executeDynamicFilter = async (filter, allData) => { - try { - const { success, data, error } = await executeFilterCode({ - code: filter.code, - data: allData - }); - if (!success) { - console.warn("[vseed] Dynamic filter execution failed:", error); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error - }; - } - try { - validateFilterResult(data, filter); - } catch (validationError) { - console.error("[vseed] Dynamic filter result validation failed:", validationError); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: validationError instanceof Error ? validationError.message : String(validationError) - }; - } - return { - success, - data - }; - } catch (error) { - const errorMessage = error instanceof Error ? error.message : String(error); - console.error("[vseed] Dynamic filter execution threw exception:", errorMessage); - return { - success: false, - data: isRowWithFieldDynamicFilter(filter) ? [] : "", - error: errorMessage - }; - } - }; - matchDynamicFilterResult = (result, datum, selectorType = "table") => { - if ("number" == typeof result || "string" == typeof result) throw new Error("matchDynamicFilterResult does not support ValueDynamicFilter results"); - if ("table" === selectorType) return result.some((item) => matchesCellSelector(datum, item)); - return result.some((item) => matchesDatum(datum, item)); - }; - selectorWithDynamicFilter = (vchartDatum, selectorConfig, defaultSelector) => { - if (!selectorConfig) return true; - if (isValueDynamicFilter(selectorConfig)) { - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - } - const selectorType = isRowWithFieldDynamicFilter(selectorConfig) ? "table" : "chart"; - if (selectorConfig.result?.success && selectorConfig.result.data) return matchDynamicFilterResult(selectorConfig.result.data, vchartDatum, selectorType); - if (selectorConfig.fallback) { - const fallbackSelector = Array.isArray(selectorConfig.fallback) ? selectorConfig.fallback : [selectorConfig.fallback]; - return selector_selector(vchartDatum, fallbackSelector); - } - return defaultSelector ? selector_selector(vchartDatum, defaultSelector) : false; - }; -})); -//#endregion -//#region ../vseed/dist/esm/dataSelector/index.js -var init_dataSelector$1 = __esmMin((() => { - init_selector$1(); -})); -//#endregion //#region ../vseed/dist/esm/pipeline/spec/chart/pipes/label/label.js var label_label, generateMeasureValue, generateMeasurePercent, buildLabel$2; var init_label$3 = __esmMin((() => { diff --git a/apps/website/docs/public/storybook/zh-CN/assets/vendor.js b/apps/website/docs/public/storybook/zh-CN/assets/vendor.js index 173d315829..a2db127c02 100644 --- a/apps/website/docs/public/storybook/zh-CN/assets/vendor.js +++ b/apps/website/docs/public/storybook/zh-CN/assets/vendor.js @@ -50363,7 +50363,7 @@ var init_color$6 = __esmMin((() => { var init_type$70 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.24/node_modules/@visactor/vutils/es/padding.js -function normalizePadding(padding) { +function normalizePadding$1(padding) { if (isValidNumber$1(padding)) return [ padding, padding, @@ -97171,7 +97171,7 @@ var init_tag$3 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -98052,7 +98052,7 @@ var init_line$16 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis$1.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis$1.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -98357,7 +98357,7 @@ var init_line$16 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize$1(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -101898,7 +101898,7 @@ var init_scrollbar$3 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -101910,7 +101910,7 @@ var init_scrollbar$3 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -102182,7 +102182,7 @@ var init_poptip$4 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -106455,7 +106455,7 @@ var init_pager$3 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE$1, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator$1.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -106557,7 +106557,7 @@ var init_base$20 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator$1.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -106574,7 +106574,7 @@ var init_base$20 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -106790,7 +106790,7 @@ var init_discrete$4 = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator$1.group({ x: 0, @@ -108038,7 +108038,7 @@ var init_title$9 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -109310,7 +109310,7 @@ var init_tooltip$6 = __esmMin((() => { const { visible, content, panel, keyWidth, valueWidth, hasContentShape, autoCalculatePosition, autoMeasure, align } = this.attribute; if (!visible) return void this.hideAll(); autoMeasure && Tooltip$2.measureTooltip(this.attribute), autoCalculatePosition && Tooltip$2.calculateTooltipPosition(this.attribute); - const padding = normalizePadding(this.attribute.padding); + const padding = normalizePadding$1(this.attribute.padding); this._tooltipPanel = this.createOrUpdateChild("tooltip-background", Object.assign({ visible: !0 }, panel), "rect"), this._tooltipTitleContainer = this.createOrUpdateChild("tooltip-title", { visible: !0, x: padding[3], @@ -109405,7 +109405,7 @@ var init_tooltip$6 = __esmMin((() => { return "left" === positionX ? x -= tooltipBoxWidth + offsetX : "center" === positionX ? x -= tooltipBoxWidth / 2 : x += offsetX, "top" === positionY ? y -= tooltipBoxHeight + offsetY : "middle" === positionY ? y -= tooltipBoxHeight / 2 : y += offsetY, x + tooltipBoxWidth > parentBounds.x2 && (x -= tooltipBoxWidth + offsetX), y + tooltipBoxHeight > parentBounds.y2 && (y -= tooltipBoxHeight + offsetY), x < parentBounds.x1 && (x = parentBounds.x1), y < parentBounds.y1 && (y = parentBounds.y1), attribute.x = x, attribute.y = y, attribute; } static measureTooltip(attribute) { - const { content, contentStyle } = attribute, padding = normalizePadding(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); + const { content, contentStyle } = attribute, padding = normalizePadding$1(attribute.padding), titleAttr = Tooltip$2.getTitleAttr(attribute); let maxWidth = 0, containerHeight = padding[0] + padding[2], titleMaxHeight = 0; const { value: titleValue, shape: titleShape } = titleAttr, { visible: titleHasShape = !1, symbolType: titleShapeType = "" } = null != titleShape ? titleShape : {}; if (isValid$1(titleValue) && "object" != typeof titleAttr.value.text) { @@ -124115,7 +124115,7 @@ var init_heatmap$2 = __esmMin((() => { } initCellBackgroundMarkStyle() { var _a, _b, _c; - const padding = normalizePadding(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); + const padding = normalizePadding$1(null !== (_c = null === (_b = null === (_a = this._spec.cellBackground) || void 0 === _a ? void 0 : _a.style) || void 0 === _b ? void 0 : _b.padding) && void 0 !== _c ? _c : 0); this.setMarkStyle(this._backgroundMark, { x: (datum) => { const width = this.getCellSize(this._xAxisHelper); @@ -130876,7 +130876,7 @@ function transformLabelAttributes(label, markerData, markAttributeContext) { return (null == shape ? void 0 : shape.visible) ? labelAttrs.shape = Object.assign({ visible: !0 }, transformToGraphic$1(shape.style)) : labelAttrs.shape = { visible: !1 }, !1 !== labelBackground.visible ? (labelAttrs.panel = Object.assign({ visible: !0, customShape: labelBackground.customShape - }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; + }, transformStyle(transformToGraphic$1(labelBackground.style), markerData, markAttributeContext)), isValid$1(labelBackground.padding) && (labelAttrs.padding = normalizePadding$1(labelBackground.padding))) : (labelAttrs.panel = { visible: !1 }, labelAttrs.padding = 0), style && (labelAttrs.textStyle = transformStyle(transformToGraphic$1(style), markerData, markAttributeContext)), labelAttrs; } return { visible: !1 }; } @@ -134695,7 +134695,7 @@ var init_style$5 = __esmMin((() => { let panelPadding = null; null != border && border.color && (panelStyle.borderColor = border.color), backgroundColor && (panelStyle.backgroundColor = backgroundColor), panelStyle.boxShadow = shadow ? `${shadow.x}px ${shadow.y}px ${shadow.blur}px ${shadow.spread}px ${shadow.color}` : "initial"; const { radius } = null != border ? border : {}; - return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { + return isValid$1(radius) && (panelStyle.borderRadius = isValidNumber$1(radius) ? `${radius}px` : `${radius}`), isValid$1(padding) && (panelPadding = normalizePadding$1(padding), panelStyle.padding = getPixelPropertyStr(panelPadding)), { panelStyle, panelPadding }; @@ -135019,7 +135019,7 @@ var init_attribute = __esmMin((() => { }; getTooltipAttributes = (actualTooltip, spec, globalFontFamily) => { var _a, _b, _c, _d, _e; - const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { + const { style = {}, enterable, transitionDuration } = spec, { panel = {}, titleLabel, shape, keyLabel, valueLabel, spaceRow: commonSpaceRow, align } = style, padding = normalizePadding$1(panel.padding), paddingSpec = normalizeLayoutPaddingSpec(panel.padding), titleStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, titleLabel), globalFontFamily), keyStyle = getTextAttributes(Object.assign({ textAlign: "right" === align ? "right" : "left" }, keyLabel), globalFontFamily), valueStyle = getTextAttributes(valueLabel, globalFontFamily), shapeStyle = { fill: !0, size: null !== (_a = null == shape ? void 0 : shape.size) && void 0 !== _a ? _a : 8, spacing: null !== (_b = null == shape ? void 0 : shape.spacing) && void 0 !== _b ? _b : 6 @@ -156416,7 +156416,7 @@ var init_scrollbar$1 = __esmMin((() => { height: sliderSize }; const slider = group.createOrUpdateChild("slider", Object.assign(Object.assign(Object.assign(Object.assign({}, sliderAttribute), { cornerRadius: this._getDefaultSliderCornerRadius() }), sliderStyle), { - boundsPadding: normalizePadding(padding), + boundsPadding: normalizePadding$1(padding), pickMode: "imprecise" }), "rect"); this._slider = slider, this._container = group; @@ -156428,7 +156428,7 @@ var init_scrollbar$1 = __esmMin((() => { } getSliderRenderBounds() { if (this._sliderRenderBounds) return this._sliderRenderBounds; - const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding(padding), renderBounds = { + const { width, height, padding = 2 } = this.attribute, [top, right, bottom, left] = normalizePadding$1(padding), renderBounds = { x1: left, y1: top, x2: width - right, @@ -156647,7 +156647,7 @@ var init_tag$1 = __esmMin((() => { render() { var _a, _b, _c; this.cacheStates(); - const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("tag-content", { + const { text = "", textStyle = {}, shape = {}, panel = {}, space = 4, minWidth, maxWidth, padding = 4, visible, state, type, textAlwaysCenter, containerTextAlign } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("tag-content", { x: 0, y: 0, zIndex: 1 @@ -156882,7 +156882,7 @@ var init_poptip$1 = __esmMin((() => { const { titleStyle = {}, position, contentStyle = {}, panel, logoSymbol, poptipAnchor = "position", logoText, logoTextStyle = {}, triangleMode = "default", space = 4, minWidth = 0, maxWidth = Infinity, padding = 4, maxWidthPercent, visible, state, dx = 0, dy = 0, positionBounds } = this.attribute; let { title = "", content = "" } = this.attribute; title = this.attribute.titleFormatMethod ? this.attribute.titleFormatMethod(title) : title, content = this.attribute.contentFormatMethod ? this.attribute.contentFormatMethod(content) : content; - const parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("poptip-content", { + const parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("poptip-content", { x: 0, y: 0, zIndex: 1 @@ -163699,7 +163699,7 @@ var init_line$3 = __esmMin((() => { constructor(attributes, options) { var _a; if (attributes.labelHoverOnAxis && (attributes.labelHoverOnAxis.textStyle = Object.assign({}, attributes.label.style, attributes.labelHoverOnAxis.textStyle), void 0 === attributes.labelHoverOnAxis.space)) { - const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; + const { padding = 2 } = attributes.labelHoverOnAxis, parsedPadding = normalizePadding$1(padding), toDiffPadding = "bottom" === attributes.orient ? parsedPadding[0] : "left" === attributes.orient ? parsedPadding[1] : "top" === attributes.orient ? parsedPadding[2] : parsedPadding[3], space = (null !== (_a = attributes.label.space) && void 0 !== _a ? _a : LineAxis.defaultAttributes.label.space) - toDiffPadding; attributes.labelHoverOnAxis.space = space; } super((null == options ? void 0 : options.skipDefault) ? attributes : merge$3({}, LineAxis.defaultAttributes, attributes), options), this.labelHoverOnAxisGroup = null; @@ -164004,7 +164004,7 @@ var init_line$3 = __esmMin((() => { const axisLineWidth = line && line.visible ? null !== (_b = line.style.lineWidth) && void 0 !== _b ? _b : 1 : 0, tickLength = tick && tick.visible ? null !== (_c = tick.length) && void 0 !== _c ? _c : 4 : 0; if (title && title.visible && "string" == typeof title.text) { titleHeight = measureTextSize(title.text, title.textStyle, null === (_e = null === (_d = this.stage) || void 0 === _d ? void 0 : _d.getTheme()) || void 0 === _e ? void 0 : _e.text).height; - const padding = normalizePadding(title.padding); + const padding = normalizePadding$1(title.padding); titleSpacing = title.space + padding[0] + padding[2]; } return limitLength && (limitLength = (limitLength - labelSpace - titleSpacing - titleHeight - axisLineWidth - tickLength) / layerCount), limitLength; @@ -164572,7 +164572,7 @@ var init_pager$1 = __esmMin((() => { this._reset(); const { layout = "horizontal", handler = DEFAULT_HANDLER_STYLE, total, defaultCurrent = 1, textStyle, padding = 0 } = this.attribute; this._current = defaultCurrent; - const parsedPadding = normalizePadding(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ + const parsedPadding = normalizePadding$1(padding), isHorizontal = "horizontal" === layout, container = graphicCreator.group({ x: 0, y: 0 }), handlerStyle = handler.style || {}, handlerSize = handlerStyle.size || 15, handlerSpace = null !== (_a = handler.space) && void 0 !== _a ? _a : 8, handlerState = handler.state || {}; @@ -164674,7 +164674,7 @@ var init_base$1 = __esmMin((() => { render() { this.removeAllChild(!0); const { interactive = !0, title, padding = 0 } = this.attribute; - this._parsedPadding = normalizePadding(padding); + this._parsedPadding = normalizePadding$1(padding); const innerView = graphicCreator.group({ x: this._parsedPadding[3], y: this._parsedPadding[0], @@ -164691,7 +164691,7 @@ var init_base$1 = __esmMin((() => { y: 0, text, textStyle, - padding: normalizePadding(padding), + padding: normalizePadding$1(padding), minWidth, maxWidth }; @@ -164901,7 +164901,7 @@ var init_discrete = __esmMin((() => { } _renderEachItem(item, isSelected, index, items) { var _a, _b; - const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding(padding); + const { id, label, value, shape } = item, { padding = 0, focus, focusIconStyle, align, autoEllipsisStrategy } = this.attribute.item, { shape: shapeAttr, label: labelAttr, value: valueAttr, background } = this.attribute.item, shapeStyle = this._handleStyle(shapeAttr, item, isSelected, index, items), labelStyle = this._handleStyle(labelAttr, item, isSelected, index, items), valueStyle = this._handleStyle(valueAttr, item, isSelected, index, items), backgroundStyle = this._handleStyle(background, item, isSelected, index, items), parsedPadding = normalizePadding$1(padding); let itemGroup; !1 === background.visible ? (itemGroup = graphicCreator.group({ x: 0, @@ -166113,7 +166113,7 @@ var init_title$4 = __esmMin((() => { } render() { var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v; - const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding(padding), group = this.createOrUpdateChild("title-container", { + const { textType, text, subtextType, textStyle = {}, subtext, subtextStyle = {}, width, height, minWidth, maxWidth, minHeight, maxHeight, align, verticalAlign, padding = 0 } = this.attribute, parsedPadding = normalizePadding$1(padding), group = this.createOrUpdateChild("title-container", { x: parsedPadding[3], y: parsedPadding[0], zIndex: 1 @@ -169074,7 +169074,65 @@ var init_color = __esmMin((() => { var init_type$1 = __esmMin((() => {})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/padding.js -var init_padding$1 = __esmMin((() => {})); +function normalizePadding(padding) { + if (isValidNumber(padding)) return [ + padding, + padding, + padding, + padding + ]; + if (isArray$1(padding)) { + const length = padding.length; + if (1 === length) { + const paddingValue = padding[0]; + return [ + paddingValue, + paddingValue, + paddingValue, + paddingValue + ]; + } + if (2 === length) { + const [vertical, horizontal] = padding; + return [ + vertical, + horizontal, + vertical, + horizontal + ]; + } + if (3 === length) { + const [top, horizontal, bottom] = padding; + return [ + top, + horizontal, + bottom, + horizontal + ]; + } + if (4 === length) return padding; + } + if (isObject$9(padding)) { + const { top = 0, right = 0, bottom = 0, left = 0 } = padding; + return [ + top, + right, + bottom, + left + ]; + } + return [ + 0, + 0, + 0, + 0 + ]; +} +var init_padding$1 = __esmMin((() => { + init_isValidNumber(); + init_isArray(); + init_isObject(); +})); //#endregion //#region ../../node_modules/.pnpm/@visactor+vutils@1.0.23/node_modules/@visactor/vutils/es/time/formatUtils.js var init_formatUtils = __esmMin((() => {})); @@ -283933,4 +283991,4 @@ var init_mocker_runtime = __esmMin((() => { globalThis.__STORYBOOK_MOCKER__ = registerModuleMocker(() => new ModuleMockerInterceptor()); })); //#endregion -export { d$2 as $, init_Color as $t, init_yjs as A, H$2 as An, m$2 as At, date as B, preview_exports as Bn, PivotTableAll as Bt, init_kysely as C, isUndefined$1 as Cn, D$2 as Ct, YMap as D, init_esm$1 as Dn, i$5 as Dt, YArray as E, esm_default as En, r$3 as Et, _enum as F, h$3 as Fn, C$3 as Ft, number as G, init_chunk_6OBW3LSX as Gn, boxplot as Gt, init_schemas as H, init_entry_preview_docs as Hn, ListTableAll as Ht, any$1 as I, init_client as In, init_chunk_3GOCSNFN as It, string as J, init_entry_preview as Jn, init_bin as Jt, object as K, setCustomElementsManifest as Kn, init_boxplot as Kt, array as L, proxyCustomElement as Ln, init_es$1 as Lt, init_v4 as M, createEvent as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, forceUpdate as Nn, i$7 as Nt, applyUpdate as O, StreamLight$1 as On, init_chunk_2T7K3PFL as Ot, init_zod as P, getRenderingRef as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, setup as Qn, Color as Qt, boolean as R, transformTag as Rn, PivotChart as Rt, Kysely as S, init_isUndefined as Sn, y$2 as St, UndoManager as T, isNil as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_argtypes_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, entry_preview_docs_exports as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_argtypes as Wn, init_es$4 as Wt, union as X, init_preload_helper as Xn, init_register$1 as Xt, tuple as Y, __vitePreload as Yn, chartModule as Yt, require_tinycolor as Z, init_runtime as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, pickWithout as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, regressionPolynomial as an, init_chunk_BO3LQZNF as at, init_sql as b, init_isArray as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_logistic as cn, n$2 as ct, init_LikeFilled as d, regressionLinear as dn, e$1 as dt, ecdf as en, init_chunk_BCBB46UE as et, init_dist$2 as f, clamper as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, init_pickWithout as gn, t$1 as gt, init_postgres_adapter as h, init_array$1 as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_regression_polynomial as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, Host as jn, T$2 as jt, encodeStateAsUpdate as k, init_streamLight$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLogistic as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, array$2 as mn, n$3 as mt, init_mocker_runtime as n, init_kde as nn, k$2 as nt, SettingOutlined as o, init_regression_lowess as on, o$2 as ot, init_esm as p, init_clamper as pn, init_chunk_JK3VNB42 as pt, record as q, entry_preview_exports as qn, bin as qt, init_es as r, kde as rn, i$3 as rt, init_SettingOutlined as s, regressionLowess as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_ecdf as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_linear as un, o$3 as ut, DummyDriver as v, init_merge as vn, t$2 as vt, Doc as w, init_isNil as wn, init_chunk_PDQFB3TV as wt, sql as x, isArray$1 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, merge$2 as yn, i$4 as yt, custom as z, init_preview as zn, init_PivotChart as zt }; +export { d$2 as $, init_runtime as $n, normalizePadding as $t, init_yjs as A, StreamLight$1 as An, m$2 as At, date as B, transformTag as Bn, PivotTableAll as Bt, init_kysely as C, isArray$1 as Cn, D$2 as Ct, YMap as D, isNil as Dn, i$5 as Dt, YArray as E, init_isNil as En, r$3 as Et, _enum as F, forceUpdate as Fn, C$3 as Ft, number as G, entry_preview_argtypes_exports as Gn, boxplot as Gt, init_schemas as H, preview_exports as Hn, ListTableAll as Ht, any$1 as I, getRenderingRef as In, init_chunk_3GOCSNFN as It, string as J, setCustomElementsManifest as Jn, init_bin as Jt, object as K, init_entry_preview_argtypes as Kn, init_boxplot as Kt, array as L, h$3 as Ln, init_es$1 as Lt, init_v4 as M, H$2 as Mn, init_chunk_7ZI6JRPB as Mt, v4 as N, Host as Nn, i$7 as Nt, applyUpdate as O, esm_default as On, init_chunk_2T7K3PFL as Ot, init_zod as P, createEvent as Pn, init_chunk_QJLMYOTX as Pt, init_dist$5 as Q, init_preload_helper as Qn, init_padding$1 as Qt, boolean as R, init_client as Rn, PivotChart as Rt, Kysely as S, init_isArray as Sn, y$2 as St, UndoManager as T, isUndefined$1 as Tn, init_chunk_BZNENX2T as Tt, lazy$2 as U, entry_preview_docs_exports as Un, init_ListTable_all as Ut, discriminatedUnion as V, init_preview as Vn, init_PivotTable_all as Vt, literal as W, init_entry_preview_docs as Wn, init_es$4 as Wt, union as X, init_entry_preview as Xn, init_register$1 as Xt, tuple as Y, entry_preview_exports as Yn, chartModule as Yt, require_tinycolor as Z, __vitePreload as Zn, init_es$5 as Zt, init_postgres_query_compiler as _, init_array$1 as _n, init_chunk_5S4PYKVY as _t, init_UserOutlined as a, kde as an, init_chunk_BO3LQZNF as at, init_sql as b, init_merge as bn, init_chunk_3ZJAREUD as bt, MailOutlined as c, init_regression_lowess as cn, n$2 as ct, init_LikeFilled as d, regressionLogistic as dn, e$1 as dt, Color as en, setup as er, init_chunk_BCBB46UE as et, init_dist$2 as f, init_regression_linear as fn, init_chunk_6GTAPB47 as ft, PostgresQueryCompiler as g, array$2 as gn, t$1 as gt, init_postgres_adapter as h, init_clamper as hn, init_chunk_SFZGYJFI as ht, UserOutlined as i, init_kde as in, init_chunk_HVPVHFDT as it, init_dist$4 as j, init_streamLight$1 as jn, T$2 as jt, encodeStateAsUpdate as k, init_esm$1 as kn, init_chunk_NFFV4IQT as kt, init_MailOutlined as l, regressionLowess as ln, init_chunk_NMC53JVB as lt, PostgresAdapter as m, clamper as mn, n$3 as mt, init_mocker_runtime as n, ecdf as nn, k$2 as nt, SettingOutlined as o, init_regression_polynomial as on, o$2 as ot, init_esm as p, regressionLinear as pn, init_chunk_JK3VNB42 as pt, record as q, init_chunk_6OBW3LSX as qn, bin as qt, init_es as r, init_ecdf as rn, i$3 as rt, init_SettingOutlined as s, regressionPolynomial as sn, init_chunk_VCYTMP4D as st, ModuleMockerInterceptor as t, init_Color as tn, init_chunk_HGKLN5KY as tt, LikeFilled as u, init_regression_logistic as un, o$3 as ut, DummyDriver as v, init_pickWithout as vn, t$2 as vt, Doc as w, init_isUndefined as wn, init_chunk_PDQFB3TV as wt, sql as x, merge$2 as xn, init_chunk_KI5X74E2 as xt, init_dummy_driver as y, pickWithout as yn, i$4 as yt, custom as z, proxyCustomElement as zn, init_PivotChart as zt }; diff --git a/packages/vseed/AGENTS.md b/packages/vseed/AGENTS.md index 74115eddfa..d606629e86 100644 --- a/packages/vseed/AGENTS.md +++ b/packages/vseed/AGENTS.md @@ -184,6 +184,8 @@ VSeed 支持在 DSL 中写动态过滤逻辑(code),在 build 前执行。 - 组合式 pipeline 构建图表类型 - 适配器模式(如 pivotAdapter)承接条件分支 +`stackCornerRadius` 的裁剪同时限制柱体描边的外扩。即使未配置圆角、使用单系列或条件圆角,也应保留静态柱体的裁剪边界;匹配显式 `barRadius` 时,裁剪圆角不应大于图元圆角,避免把直角裁成圆角。`moveIn` 因图元尚未到达最终位置,使用图元圆角而不使用最终位置裁剪。 + 详见: - `apps/website/docs/zh-CN/vseed/development/designPhilosophy/pipeline/pipelineDesign.md` diff --git a/packages/vseed/src/pipeline/spec/chart/pipes/stack/stackCornerRadius.ts b/packages/vseed/src/pipeline/spec/chart/pipes/stack/stackCornerRadius.ts index a5735038ea..795efac3a5 100644 --- a/packages/vseed/src/pipeline/spec/chart/pipes/stack/stackCornerRadius.ts +++ b/packages/vseed/src/pipeline/spec/chart/pipes/stack/stackCornerRadius.ts @@ -1,5 +1,7 @@ import type { IBarChartSpec } from '@visactor/vchart' +import { normalizePadding } from '@visactor/vutils' import type { VChartSpecPipe, StackCornerRadius, BarStyle } from 'src/types' +import { selector, selectorWithDynamicFilter } from 'src/dataSelector' import { createBarCornerRadius, createStackCornerRadius, hasMoveInAnimation } from './stackCornerRadiusUtils' const hasBarMoveInAnimation = (spec: IBarChartSpec): boolean => { @@ -11,22 +13,32 @@ const hasBarMoveInAnimation = (spec: IBarChartSpec): boolean => { export const stackCornerRadius: VChartSpecPipe = (spec, context) => { const { advancedVSeed, vseed } = context const { chartType } = vseed - const stackCornerRadius = advancedVSeed.config?.[chartType as 'column']?.stackCornerRadius as StackCornerRadius + const stackCornerRadius = (advancedVSeed.config?.[chartType as 'column']?.stackCornerRadius ?? 0) as StackCornerRadius - const styles = advancedVSeed.markStyle?.barStyle - const rules = (Array.isArray(styles) ? styles : styles ? [styles] : []) as BarStyle[] - // A stack clip would trim explicit per-bar corners, including conditional rules. - if (stackCornerRadius == null || rules.some((rule) => rule.barRadius != null)) { - return spec + if (!hasBarMoveInAnimation(spec as IBarChartSpec)) { + const styles = advancedVSeed.markStyle?.barStyle + const rules = ((Array.isArray(styles) ? styles : styles ? [styles] : []) as BarStyle[]) + .filter((rule) => rule.barRadius != null) + .reverse() + const defaultRadius = createStackCornerRadius(stackCornerRadius) + // Preserve the stroke bounds without rounding more than an explicit per-bar corner. + const clipRadius: typeof defaultRadius = rules.length + ? (attributes, datum) => { + const radius = defaultRadius(attributes, datum) + const rule = rules.find((rule) => + rule.dynamicFilter + ? selectorWithDynamicFilter(datum, rule.dynamicFilter, rule.selector) + : selector(datum, rule.selector), + ) + if (!rule) return radius + const barRadius = normalizePadding(rule.barRadius!) + return normalizePadding(radius).map((corner, index) => Math.min(corner, barRadius[index])) + } + : defaultRadius + return { ...spec, stackCornerRadius: clipRadius } as IBarChartSpec } - const singleSeries = advancedVSeed.datasetReshapeInfo?.[0]?.unfoldInfo.colorItems.length === 1 - - if (!singleSeries && !hasBarMoveInAnimation(spec as IBarChartSpec)) { - return { ...spec, stackCornerRadius: createStackCornerRadius(stackCornerRadius) } as IBarChartSpec - } - - // A single series needs no stack clip; a final-position clip also cuts off moveIn. + // A final-position clip would cut off moveIn before it reaches the bar bounds. return { ...spec, bar: { diff --git a/packages/vseed/tests/unit/builder/barClipping.test.ts b/packages/vseed/tests/unit/builder/barClipping.test.ts new file mode 100644 index 0000000000..1f34702272 --- /dev/null +++ b/packages/vseed/tests/unit/builder/barClipping.test.ts @@ -0,0 +1,37 @@ +import VChart from '@visactor/vchart' +import { Builder, registerAll } from 'src/builder' +import type { VSeed } from 'src/types' +import columnCase from '../../integrations/columnParallel/markStyle/selectorBarDimensionCondition.json' +import barCase from '../../integrations/barParallel/markStyle/barStyleMeasureCondition.json' +import dualAxisCase from '../../integrations/dualAxis/combination/columnParallelLine.json' + +beforeAll(registerAll) + +test.each([columnCase, barCase, dualAxisCase])('$name keeps strokes within the native bar bounds', (fixture) => { + const spec = Builder.from(fixture.vseed as VSeed).build() + const element = document.createElement('div') + document.body.append(element) + const chart = new VChart({ ...spec, width: 500, height: 500 }, { dom: element, animation: false }) + try { + chart.renderSync() + for (const series of chart.getChart()!.getAllSeries()) { + const mark = series.getMarkInName('bar') + if (!mark) continue + const config = mark.getMarkConfig() as any + expect(config.clip).toBe(true) + const rectangles = config.clipPath() + const data = series.getViewData()!.latestData + expect(rectangles).toHaveLength(data.length) + const channels = + series.getSpec().direction === 'horizontal' ? ['x', 'x1', 'y', 'height'] : ['x', 'y', 'y1', 'width'] + rectangles.forEach((rectangle: any, index: number) => { + for (const channel of channels) { + expect(rectangle.attribute[channel]).toBeCloseTo(mark.getAttribute(channel, data[index]) as number) + } + }) + } + } finally { + chart.release() + element.remove() + } +}) diff --git a/packages/vseed/tests/unit/builder/barGradient.test.ts b/packages/vseed/tests/unit/builder/barGradient.test.ts index 47967f1ed8..973f8f2b3d 100644 --- a/packages/vseed/tests/unit/builder/barGradient.test.ts +++ b/packages/vseed/tests/unit/builder/barGradient.test.ts @@ -53,7 +53,7 @@ test.each(['column', 'bar', 'columnParallel', 'barParallel', 'columnPercent', 'b { offset: 1, color: 'rgba(255,0,0,0.5)' }, ], }) - expect(spec.stackCornerRadius).toBeUndefined() + expect(spec.stackCornerRadius).toBeTypeOf('function') }, ) diff --git a/packages/vseed/tests/unit/builder/barUpdates.test.ts b/packages/vseed/tests/unit/builder/barUpdates.test.ts index 1b9cde4f7d..527f73185a 100644 --- a/packages/vseed/tests/unit/builder/barUpdates.test.ts +++ b/packages/vseed/tests/unit/builder/barUpdates.test.ts @@ -33,9 +33,11 @@ describe('bar geometry across spec updates', () => { const current = chart.getChart()!.getAllSeries()[0] expect(current === series).toBe(true) const mark = current.getMarkInName('bar')! - expect( - current.getViewData()!.latestData.map((datum: any) => mark.getAttribute('cornerRadius', datum)), - ).toEqual(values.map((value) => (value > 0 ? [4, 4, 0, 0] : [0, 0, 4, 4]))) + const config = mark.getMarkConfig() as any + expect(config.clip).toBe(true) + expect(config.clipPath().map((rectangle: any) => rectangle.attribute.cornerRadius)).toEqual( + values.map((value) => (value > 0 ? [4, 4, 0, 0] : [0, 0, 4, 4])), + ) } } finally { chart.release() diff --git a/packages/vseed/tests/unit/pipeline/spec/chart/pipes/stack/stackCornerRadius.test.ts b/packages/vseed/tests/unit/pipeline/spec/chart/pipes/stack/stackCornerRadius.test.ts index bddc28a3ca..18eba8cc6c 100644 --- a/packages/vseed/tests/unit/pipeline/spec/chart/pipes/stack/stackCornerRadius.test.ts +++ b/packages/vseed/tests/unit/pipeline/spec/chart/pipes/stack/stackCornerRadius.test.ts @@ -31,7 +31,7 @@ describe('stackCornerRadius pipe', () => { expect(createStackCornerRadius([7, 7, 0, 0])).not.toBe(callback) }) - it.each([0, 4, [4, 4, 4, 4]])('explicit per-bar corners %j take priority over a stack clip', (barRadius) => { + it.each([0, 4, [4, 4, 4, 4]])('explicit per-bar corners %j retain the stroke clip', (barRadius) => { const spec = Builder.from({ chartType: 'column', dataset: [{ category: 'A', value: 10 }], @@ -39,11 +39,13 @@ describe('stackCornerRadius pipe', () => { measures: [{ id: 'value' }], barStyle: { barRadius }, }).build() - expect(spec.stackCornerRadius).toBeUndefined() + expect(spec.stackCornerRadius(null, { __VCHART_STACK_START: 0, __VCHART_STACK_END: 10 })).toEqual( + barRadius === 0 ? [0, 0, 0, 0] : [4, 4, 0, 0], + ) expect(spec.bar.style.cornerRadius).toEqual(barRadius) }) - it('retains the stack clip for colors but removes it for conditional per-bar corners', () => { + it('conditional per-bar corners preserve the default outline on unmatched bars', () => { const dsl = { chartType: 'column' as const, dataset: [ @@ -57,9 +59,54 @@ describe('stackCornerRadius pipe', () => { 'function', ) const spec = Builder.from({ ...dsl, barStyle: { selector: { value: -10 }, barRadius: 5 } }).build() - expect(spec.stackCornerRadius).toBeUndefined() + expect(spec.stackCornerRadius(null, { value: -10, __VCHART_STACK_START: -10, __VCHART_STACK_END: 0 })).toEqual([ + 0, 0, 4, 4, + ]) + expect(spec.stackCornerRadius(null, { value: 20, __VCHART_STACK_START: 0, __VCHART_STACK_END: 20 })).toEqual([ + 4, 4, 0, 0, + ]) expect(spec.bar.state.custom1.style.cornerRadius).toBe(5) }) + + it('dynamic corner rules preserve the default outline when they do not match', () => { + const context = createContext() + context.advancedVSeed.markStyle = { + barStyle: { + barRadius: 0, + dynamicFilter: { + type: 'row-with-field', + code: '', + result: { success: true, data: [{ __row_index: 0, field: 'value' }] }, + }, + }, + } + const spec = stackCornerRadius({}, context) as any + expect(spec.stackCornerRadius(null, { __row_index: 0, __MeaId__: 'value', value: 10 })).toEqual([0, 0, 0, 0]) + expect(spec.stackCornerRadius(null, { __row_index: 1, __VCHART_STACK_START: 0, __VCHART_STACK_END: 10 })).toEqual([ + 4, 4, 0, 0, + ]) + }) + + it('still clips strokes when no radius is configured', () => { + const context = createContext() + context.advancedVSeed.config = {} + const spec = stackCornerRadius({}, context) as any + expect(spec.stackCornerRadius(null, { __VCHART_STACK_START: 0, __VCHART_STACK_END: 10 })).toBe(0) + }) + + it('honors asymmetric corners and the last matching radius rule', () => { + const context = createContext() + context.advancedVSeed.markStyle = { + barStyle: [{ barRadius: [0, 8, 8, 0] }, { selector: { value: 10 }, barRadius: 2 }], + } + const spec = stackCornerRadius({}, context) as any + expect(spec.stackCornerRadius(null, { value: 10, __VCHART_STACK_START: 0, __VCHART_STACK_END: 10 })).toEqual([ + 2, 2, 0, 0, + ]) + expect(spec.stackCornerRadius(null, { value: -10, __VCHART_STACK_START: -10, __VCHART_STACK_END: 0 })).toEqual([ + 0, 0, 4, 0, + ]) + }) it('should use root stackCornerRadius when no moveIn animation exists', () => { const result = stackCornerRadius({}, createContext()) as any diff --git a/packages/vseed/vite.config.ts b/packages/vseed/vite.config.ts index 8308bc3de6..ffc7af7ce4 100644 --- a/packages/vseed/vite.config.ts +++ b/packages/vseed/vite.config.ts @@ -20,10 +20,10 @@ export default defineConfig(({ mode }) => ({ // V8 branch counts vary slightly between runs; use verified floors. thresholds: mode === 'unit' - ? { statements: 81.9, lines: 81.9, branches: 75.7, functions: 80.3 } + ? { statements: 82, lines: 82, branches: 76, functions: 80.6 } : mode === 'integration' ? undefined - : { statements: 90.4, lines: 90.4, branches: 81.3, functions: 83.2 }, + : { statements: 90.5, lines: 90.5, branches: 81.5, functions: 83.4 }, }, globals: true, environment: 'jsdom',