@pisell/materials 1.10.10 → 1.10.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -33,14 +33,23 @@ const PisellSuperTabs = (props, ref) => {
33
33
  if (!item || !scrollContainer) return;
34
34
  const containerRect = scrollContainer.getBoundingClientRect();
35
35
  const itemRect = item.getBoundingClientRect();
36
+ const containerStyle = window.getComputedStyle(scrollContainer);
37
+ const scrollPaddingLeft = Number.parseFloat(containerStyle.scrollPaddingLeft) || 0;
38
+ const scrollPaddingRight = Number.parseFloat(containerStyle.scrollPaddingRight) || 0;
39
+ const scrollPaddingTop = Number.parseFloat(containerStyle.scrollPaddingTop) || 0;
40
+ const scrollPaddingBottom = Number.parseFloat(containerStyle.scrollPaddingBottom) || 0;
41
+ const visibleLeft = containerRect.left + scrollPaddingLeft;
42
+ const visibleRight = containerRect.right - scrollPaddingRight;
43
+ const visibleTop = containerRect.top + scrollPaddingTop;
44
+ const visibleBottom = containerRect.bottom - scrollPaddingBottom;
36
45
  const canScrollX = scrollContainer.scrollWidth > scrollContainer.clientWidth + 1;
37
46
  const canScrollY = scrollContainer.scrollHeight > scrollContainer.clientHeight + 1;
38
47
  let nextLeft = scrollContainer.scrollLeft;
39
48
  let nextTop = scrollContainer.scrollTop;
40
- if (canScrollX && itemRect.left < containerRect.left) nextLeft -= containerRect.left - itemRect.left;
41
- else if (canScrollX && itemRect.right > containerRect.right) nextLeft += itemRect.right - containerRect.right;
42
- if (canScrollY && itemRect.top < containerRect.top) nextTop -= containerRect.top - itemRect.top;
43
- else if (canScrollY && itemRect.bottom > containerRect.bottom) nextTop += itemRect.bottom - containerRect.bottom;
49
+ if (canScrollX && itemRect.left < visibleLeft) nextLeft -= visibleLeft - itemRect.left;
50
+ else if (canScrollX && itemRect.right > visibleRight) nextLeft += itemRect.right - visibleRight;
51
+ if (canScrollY && itemRect.top < visibleTop) nextTop -= visibleTop - itemRect.top;
52
+ else if (canScrollY && itemRect.bottom > visibleBottom) nextTop += itemRect.bottom - visibleBottom;
44
53
  if (nextLeft === scrollContainer.scrollLeft && nextTop === scrollContainer.scrollTop) return;
45
54
  scrollContainer.scrollTo({
46
55
  left: nextLeft,
@@ -77,12 +77,14 @@ const convertBundleOption = (option, translationOriginal) => {
77
77
  };
78
78
  const convertBundle = (bundle, translationOriginal) => {
79
79
  const options = (bundle.option || []).map((option) => convertBundleOption(option, translationOriginal));
80
+ const bundlePrice = bundle.price_type === "markdown" && Number.isFinite(Number(bundle.price)) ? -Math.abs(Number(bundle.price)) : bundle.price;
80
81
  return _objectSpread2(_objectSpread2({}, bundle), {}, {
81
82
  title: bundle.title || bundle.bundle_title,
82
83
  id: bundle.bundle_id,
83
84
  product_id: bundle.bundle_product_id,
84
85
  _bundle_product_id: bundle.bundle_product_id,
85
86
  product_variant_id: bundle.bundle_variant_id,
87
+ price: bundlePrice,
86
88
  total: bundle.bundle_selling_price,
87
89
  origin_total: bundle.original_total,
88
90
  custom_price: bundle.custom_price,
@@ -36,14 +36,23 @@ const PisellSuperTabs = (props, ref) => {
36
36
  if (!item || !scrollContainer) return;
37
37
  const containerRect = scrollContainer.getBoundingClientRect();
38
38
  const itemRect = item.getBoundingClientRect();
39
+ const containerStyle = window.getComputedStyle(scrollContainer);
40
+ const scrollPaddingLeft = Number.parseFloat(containerStyle.scrollPaddingLeft) || 0;
41
+ const scrollPaddingRight = Number.parseFloat(containerStyle.scrollPaddingRight) || 0;
42
+ const scrollPaddingTop = Number.parseFloat(containerStyle.scrollPaddingTop) || 0;
43
+ const scrollPaddingBottom = Number.parseFloat(containerStyle.scrollPaddingBottom) || 0;
44
+ const visibleLeft = containerRect.left + scrollPaddingLeft;
45
+ const visibleRight = containerRect.right - scrollPaddingRight;
46
+ const visibleTop = containerRect.top + scrollPaddingTop;
47
+ const visibleBottom = containerRect.bottom - scrollPaddingBottom;
39
48
  const canScrollX = scrollContainer.scrollWidth > scrollContainer.clientWidth + 1;
40
49
  const canScrollY = scrollContainer.scrollHeight > scrollContainer.clientHeight + 1;
41
50
  let nextLeft = scrollContainer.scrollLeft;
42
51
  let nextTop = scrollContainer.scrollTop;
43
- if (canScrollX && itemRect.left < containerRect.left) nextLeft -= containerRect.left - itemRect.left;
44
- else if (canScrollX && itemRect.right > containerRect.right) nextLeft += itemRect.right - containerRect.right;
45
- if (canScrollY && itemRect.top < containerRect.top) nextTop -= containerRect.top - itemRect.top;
46
- else if (canScrollY && itemRect.bottom > containerRect.bottom) nextTop += itemRect.bottom - containerRect.bottom;
52
+ if (canScrollX && itemRect.left < visibleLeft) nextLeft -= visibleLeft - itemRect.left;
53
+ else if (canScrollX && itemRect.right > visibleRight) nextLeft += itemRect.right - visibleRight;
54
+ if (canScrollY && itemRect.top < visibleTop) nextTop -= visibleTop - itemRect.top;
55
+ else if (canScrollY && itemRect.bottom > visibleBottom) nextTop += itemRect.bottom - visibleBottom;
47
56
  if (nextLeft === scrollContainer.scrollLeft && nextTop === scrollContainer.scrollTop) return;
48
57
  scrollContainer.scrollTo({
49
58
  left: nextLeft,
@@ -79,12 +79,14 @@ const convertBundleOption = (option, translationOriginal) => {
79
79
  };
80
80
  const convertBundle = (bundle, translationOriginal) => {
81
81
  const options = (bundle.option || []).map((option) => convertBundleOption(option, translationOriginal));
82
+ const bundlePrice = bundle.price_type === "markdown" && Number.isFinite(Number(bundle.price)) ? -Math.abs(Number(bundle.price)) : bundle.price;
82
83
  return require_objectSpread2._objectSpread2(require_objectSpread2._objectSpread2({}, bundle), {}, {
83
84
  title: bundle.title || bundle.bundle_title,
84
85
  id: bundle.bundle_id,
85
86
  product_id: bundle.bundle_product_id,
86
87
  _bundle_product_id: bundle.bundle_product_id,
87
88
  product_variant_id: bundle.bundle_variant_id,
89
+ price: bundlePrice,
88
90
  total: bundle.bundle_selling_price,
89
91
  origin_total: bundle.original_total,
90
92
  custom_price: bundle.custom_price,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pisell/materials",
3
- "version": "1.10.10",
3
+ "version": "1.10.12",
4
4
  "scripts": {
5
5
  "dev:tailwind-css": "tailwindcss -c ./tailwind.materials.config.cjs --postcss ./postcss.materials-tailwind.cjs -i ./src/tailwind-input.css -o ./src/pisell-materials.tw.css --watch",
6
6
  "build:tailwind-css:once": "tailwindcss -c ./tailwind.materials.config.cjs --postcss ./postcss.materials-tailwind.cjs -i ./src/tailwind-input.css -o ./src/pisell-materials.tw.css",
@@ -9,9 +9,6 @@
9
9
  "build": "pnpm run build:tailwind-css && father build",
10
10
  "lowcode:dev": "build-scripts start --config ./build.lowcode.js",
11
11
  "lowcode:build": " build-scripts build --config ./build.lowcode.js",
12
- "build:tsdown": "tsdown",
13
- "lowcode:rsdev": "rsbuild dev",
14
- "lowcode:rsbuild": "rsbuild build",
15
12
  "test": "vitest",
16
13
  "test:ui": "vitest --ui",
17
14
  "test:run": "vitest run",