@pisell/private-materials 3.0.120 → 3.0.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lowcode/assets-daily.json +11 -11
- package/build/lowcode/assets-dev.json +2 -2
- package/build/lowcode/assets-prod.json +11 -11
- package/build/lowcode/index.js +1 -1
- package/build/lowcode/meta.js +1 -1
- package/build/lowcode/preview.js +8 -8
- package/build/lowcode/render/default/view.css +1 -1
- package/build/lowcode/render/default/view.js +7 -7
- package/build/lowcode/view.css +1 -1
- package/build/lowcode/view.js +6 -6
- package/es/components/booking/locales.d.ts +21 -0
- package/es/components/booking/locales.js +24 -0
- package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +12 -0
- package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.js +40 -0
- package/es/components/schedules/components/ScheduleList/RenderScheduleItem/index.less +38 -0
- package/es/components/schedules/components/ScheduleList/index.d.ts +5 -4
- package/es/components/schedules/components/ScheduleList/index.js +53 -43
- package/es/components/schedules/hooks/useSchedulesDataSource.js +5 -3
- package/es/components/schedules/products/list/index.d.ts +2 -2
- package/es/components/schedules/products/list/index.js +8 -8
- package/es/components/schedules/schedules/AllSchedules/index.d.ts +3 -3
- package/es/components/schedules/schedules/AllSchedules/index.js +9 -6
- package/es/components/schedules/schedules/AllSchedules/index.less +11 -3
- package/es/components/schedules/schedules/serve.d.ts +7 -0
- package/es/components/schedules/schedules/serve.js +24 -3
- package/es/components/schedules/schedules/utils.d.ts +22 -0
- package/es/components/schedules/schedules/utils.js +143 -1
- package/es/components/schedules/type.d.ts +7 -0
- package/es/components/tabProduct/index.d.ts +3 -2
- package/es/components/tabProduct/index.js +27 -18
- package/es/components/tabProduct/tabs/index.d.ts +3 -3
- package/es/components/tabProduct/tabs/index.js +34 -21
- package/lib/components/booking/locales.d.ts +21 -0
- package/lib/components/booking/locales.js +24 -0
- package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.d.ts +12 -0
- package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.js +77 -0
- package/lib/components/schedules/components/ScheduleList/RenderScheduleItem/index.less +38 -0
- package/lib/components/schedules/components/ScheduleList/index.d.ts +5 -4
- package/lib/components/schedules/components/ScheduleList/index.js +38 -31
- package/lib/components/schedules/hooks/useSchedulesDataSource.js +8 -2
- package/lib/components/schedules/products/list/index.d.ts +2 -2
- package/lib/components/schedules/schedules/AllSchedules/index.d.ts +3 -3
- package/lib/components/schedules/schedules/AllSchedules/index.js +3 -2
- package/lib/components/schedules/schedules/AllSchedules/index.less +11 -3
- package/lib/components/schedules/schedules/serve.d.ts +7 -0
- package/lib/components/schedules/schedules/serve.js +5 -2
- package/lib/components/schedules/schedules/utils.d.ts +22 -0
- package/lib/components/schedules/schedules/utils.js +98 -0
- package/lib/components/schedules/type.d.ts +7 -0
- package/lib/components/tabProduct/index.d.ts +3 -2
- package/lib/components/tabProduct/index.js +15 -6
- package/lib/components/tabProduct/tabs/index.d.ts +3 -3
- package/lib/components/tabProduct/tabs/index.js +10 -6
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symb
|
|
|
11
11
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
12
12
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
13
13
|
import dayjs from "dayjs";
|
|
14
|
-
import { isArr } from "@pisell/utils";
|
|
14
|
+
import { isArr, locales } from "@pisell/utils";
|
|
15
15
|
/**
|
|
16
16
|
* 根据日程配置生成日历数据
|
|
17
17
|
* @param values
|
|
@@ -655,4 +655,146 @@ export var calcMinTimeMaxTimeBySchedules = function calcMinTimeMaxTimeBySchedule
|
|
|
655
655
|
dateRangeFormat: dateRangeFormat
|
|
656
656
|
}));
|
|
657
657
|
}, {});
|
|
658
|
+
};
|
|
659
|
+
|
|
660
|
+
/**
|
|
661
|
+
* @title: 格式化日程数据
|
|
662
|
+
* @description:
|
|
663
|
+
* @param {Array} relation 资源列表
|
|
664
|
+
* @param {string} table_type 关联表类型
|
|
665
|
+
* @param {string} item_type 资源类型
|
|
666
|
+
* @param {boolean} isExcluded 是否排除
|
|
667
|
+
* @return {*}
|
|
668
|
+
* @Author: WangHan
|
|
669
|
+
* @Date: 2024-09-04 11:54
|
|
670
|
+
*/
|
|
671
|
+
export var formatScheduleData = function formatScheduleData(relation, table_type, item_type, isExcluded) {
|
|
672
|
+
var _relation = relation || [];
|
|
673
|
+
// 有关联表类型和资源类型并且排除
|
|
674
|
+
if (table_type && item_type && isExcluded) {
|
|
675
|
+
return _relation.find(function (item) {
|
|
676
|
+
return (item === null || item === void 0 ? void 0 : item.relation_table_type) === table_type && (item === null || item === void 0 ? void 0 : item.item_type) !== item_type;
|
|
677
|
+
});
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
// 有关联表类型和资源类型
|
|
681
|
+
if (table_type && item_type) {
|
|
682
|
+
return _relation.find(function (item) {
|
|
683
|
+
return (item === null || item === void 0 ? void 0 : item.relation_table_type) === table_type && (item === null || item === void 0 ? void 0 : item.item_type) === item_type;
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
// 有关联表类型
|
|
688
|
+
if (table_type) {
|
|
689
|
+
return _relation.some(function (item) {
|
|
690
|
+
return (item === null || item === void 0 ? void 0 : item.relation_table_type) === table_type;
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
// 有关联资源类型
|
|
695
|
+
if (item_type) {
|
|
696
|
+
return _relation.find(function (item) {
|
|
697
|
+
return (item === null || item === void 0 ? void 0 : item.item_type) === item_type;
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* @title: 格式化日程为二维结构
|
|
704
|
+
* @description:
|
|
705
|
+
* @param {any} list
|
|
706
|
+
* @param {any} filterItem
|
|
707
|
+
* @return {*}
|
|
708
|
+
* @Author: WangHan
|
|
709
|
+
* @Date: 2024-07-29 19:28
|
|
710
|
+
*/
|
|
711
|
+
export var formatScheduleListByTabs = function formatScheduleListByTabs(list, filterItem) {
|
|
712
|
+
var _list = list || [];
|
|
713
|
+
if (filterItem) {
|
|
714
|
+
_list = _list.filter(filterItem);
|
|
715
|
+
}
|
|
716
|
+
|
|
717
|
+
// 日程分类
|
|
718
|
+
var categoryObject = {
|
|
719
|
+
// 全部
|
|
720
|
+
all: {
|
|
721
|
+
id: 0,
|
|
722
|
+
name: locales.getText('pisell2.schedule.tab.all'),
|
|
723
|
+
products: _list
|
|
724
|
+
},
|
|
725
|
+
// 附加费
|
|
726
|
+
surcharge: {
|
|
727
|
+
id: 1,
|
|
728
|
+
name: locales.getText('pisell2.schedule.tab.surcharge'),
|
|
729
|
+
products: []
|
|
730
|
+
},
|
|
731
|
+
// 资源
|
|
732
|
+
resources: {
|
|
733
|
+
id: 2,
|
|
734
|
+
name: locales.getText('pisell2.schedule.tab.resources'),
|
|
735
|
+
products: []
|
|
736
|
+
},
|
|
737
|
+
// 商品
|
|
738
|
+
products: {
|
|
739
|
+
id: 3,
|
|
740
|
+
name: locales.getText('pisell2.schedule.tab.products'),
|
|
741
|
+
products: []
|
|
742
|
+
},
|
|
743
|
+
// 活动
|
|
744
|
+
events: {
|
|
745
|
+
id: 4,
|
|
746
|
+
name: locales.getText('pisell2.schedule.tab.events'),
|
|
747
|
+
products: []
|
|
748
|
+
},
|
|
749
|
+
// 报价单
|
|
750
|
+
quotation: {
|
|
751
|
+
id: 5,
|
|
752
|
+
name: locales.getText('pisell2.schedule.tab.quotation'),
|
|
753
|
+
products: []
|
|
754
|
+
},
|
|
755
|
+
// 营业时间
|
|
756
|
+
"open-hours": {
|
|
757
|
+
id: 6,
|
|
758
|
+
name: locales.getText('pisell2.schedule.tab.open-hours'),
|
|
759
|
+
products: []
|
|
760
|
+
}
|
|
761
|
+
};
|
|
762
|
+
for (var i = 0; i < _list.length; i++) {
|
|
763
|
+
var productItem = _list[i];
|
|
764
|
+
var _relation = productItem.relation || [];
|
|
765
|
+
|
|
766
|
+
// 附加费
|
|
767
|
+
if (formatScheduleData(_relation, 'custom_surcharge')) {
|
|
768
|
+
categoryObject.surcharge.products.push(productItem);
|
|
769
|
+
}
|
|
770
|
+
// 资源
|
|
771
|
+
if (formatScheduleData(_relation, 'form', 'opening_hours', true)) {
|
|
772
|
+
categoryObject.resources.products.push(productItem);
|
|
773
|
+
}
|
|
774
|
+
// 商品
|
|
775
|
+
if (formatScheduleData(_relation, 'product')) {
|
|
776
|
+
categoryObject.products.products.push(productItem);
|
|
777
|
+
}
|
|
778
|
+
// 活动
|
|
779
|
+
if (formatScheduleData(_relation, 'product', 'event_item')) {
|
|
780
|
+
categoryObject.events.products.push(productItem);
|
|
781
|
+
}
|
|
782
|
+
// 报价单
|
|
783
|
+
if (formatScheduleData(_relation, 'shelf', 'quotation')) {
|
|
784
|
+
categoryObject.quotation.products.push(productItem);
|
|
785
|
+
}
|
|
786
|
+
// 营业时间
|
|
787
|
+
if (formatScheduleData(_relation, '', 'opening_hours')) {
|
|
788
|
+
categoryObject['open-hours'].products.push(productItem);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
// 子级没有数据则不显示该tab
|
|
793
|
+
Object.keys(categoryObject).forEach(function (cur) {
|
|
794
|
+
var _categoryObject$cur, _categoryObject$cur$p;
|
|
795
|
+
if ((categoryObject === null || categoryObject === void 0 ? void 0 : (_categoryObject$cur = categoryObject[cur]) === null || _categoryObject$cur === void 0 ? void 0 : (_categoryObject$cur$p = _categoryObject$cur.products) === null || _categoryObject$cur$p === void 0 ? void 0 : _categoryObject$cur$p.length) === 0) {
|
|
796
|
+
delete categoryObject[cur];
|
|
797
|
+
}
|
|
798
|
+
});
|
|
799
|
+
return Object.values(categoryObject);
|
|
658
800
|
};
|
|
@@ -57,6 +57,13 @@ export declare type ScheduleItem = {
|
|
|
57
57
|
/** 是否全天 */
|
|
58
58
|
is_all: 1 | 0;
|
|
59
59
|
[key: string]: any;
|
|
60
|
+
relation?: {
|
|
61
|
+
id: number;
|
|
62
|
+
item_id: number;
|
|
63
|
+
item_type: string;
|
|
64
|
+
relation_table_type: string;
|
|
65
|
+
schedule_id: number;
|
|
66
|
+
}[];
|
|
60
67
|
};
|
|
61
68
|
export declare type ScheduleFormOtherValue = {
|
|
62
69
|
/** 截止模式
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
3
|
export interface TabProductProps {
|
|
4
4
|
list?: any[];
|
|
5
5
|
scrollDom?: string;
|
|
@@ -10,6 +10,7 @@ export interface TabProductProps {
|
|
|
10
10
|
listWrapClassName?: string;
|
|
11
11
|
warpClassName?: string;
|
|
12
12
|
stickyTop?: number;
|
|
13
|
+
name?: string | number;
|
|
13
14
|
}
|
|
14
15
|
declare const TabProduct: (props: TabProductProps) => React.JSX.Element;
|
|
15
16
|
export default TabProduct;
|
|
@@ -5,25 +5,27 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
5
5
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
6
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
7
7
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
-
import React, { useEffect, useState, useRef } from
|
|
8
|
+
import React, { useEffect, useState, useRef } from 'react';
|
|
9
9
|
import Tabs from "./tabs";
|
|
10
10
|
import Card from "./card";
|
|
11
|
-
import classNames from
|
|
11
|
+
import classNames from 'classnames';
|
|
12
12
|
import "./index.less";
|
|
13
13
|
var io = null;
|
|
14
|
+
var tabsHeight = 92;
|
|
14
15
|
var TabProduct = function TabProduct(props) {
|
|
15
16
|
var _props$list = props.list,
|
|
16
17
|
list = _props$list === void 0 ? [] : _props$list,
|
|
17
18
|
scrollDom = props.scrollDom,
|
|
18
19
|
_props$rowKey = props.rowKey,
|
|
19
|
-
rowKey = _props$rowKey === void 0 ?
|
|
20
|
+
rowKey = _props$rowKey === void 0 ? 'id' : _props$rowKey,
|
|
20
21
|
tabsWrapClassName = props.tabsWrapClassName,
|
|
21
22
|
categoryWrapClassName = props.categoryWrapClassName,
|
|
22
23
|
listWrapClassName = props.listWrapClassName,
|
|
23
24
|
renderItem = props.renderItem,
|
|
24
25
|
warpClassName = props.warpClassName,
|
|
25
26
|
_props$stickyTop = props.stickyTop,
|
|
26
|
-
stickyTop = _props$stickyTop === void 0 ? 0 : _props$stickyTop
|
|
27
|
+
stickyTop = _props$stickyTop === void 0 ? 0 : _props$stickyTop,
|
|
28
|
+
name = props.name;
|
|
27
29
|
var tabsRef = useRef();
|
|
28
30
|
var _useState = useState(1),
|
|
29
31
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -36,19 +38,25 @@ var TabProduct = function TabProduct(props) {
|
|
|
36
38
|
}
|
|
37
39
|
}, [list]);
|
|
38
40
|
var handleObserver = function handleObserver() {
|
|
41
|
+
var _document$querySelect;
|
|
42
|
+
var domHeight = scrollDom ? ((_document$querySelect = document.querySelector(scrollDom)) === null || _document$querySelect === void 0 ? void 0 : _document$querySelect.clientHeight) || window.innerHeight : window.innerHeight;
|
|
43
|
+
var marginTop = "-".concat(tabsHeight, "px");
|
|
44
|
+
var marginBottom = "-".concat(domHeight - tabsHeight - 10, "px");
|
|
39
45
|
io = new IntersectionObserver(function (entries) {
|
|
40
46
|
console.log(entries);
|
|
41
47
|
if (entries[0].isIntersecting) {
|
|
42
48
|
var _entries$, _entries$$target, _entries$$target$id, _tabsRef$current;
|
|
43
|
-
var _entries$0$target$id$ = (_entries$ = entries[0]) === null || _entries$ === void 0 ? void 0 : (_entries$$target = _entries$.target) === null || _entries$$target === void 0 ? void 0 : (_entries$$target$id = _entries$$target.id) === null || _entries$$target$id === void 0 ? void 0 : _entries$$target$id.split(
|
|
49
|
+
var _entries$0$target$id$ = (_entries$ = entries[0]) === null || _entries$ === void 0 ? void 0 : (_entries$$target = _entries$.target) === null || _entries$$target === void 0 ? void 0 : (_entries$$target$id = _entries$$target.id) === null || _entries$$target$id === void 0 ? void 0 : _entries$$target$id.split('-'),
|
|
44
50
|
_entries$0$target$id$2 = _slicedToArray(_entries$0$target$id$, 2),
|
|
45
|
-
|
|
51
|
+
_name = _entries$0$target$id$2[0],
|
|
46
52
|
id = _entries$0$target$id$2[1];
|
|
47
53
|
setCurrent(Number(id));
|
|
48
54
|
tabsRef === null || tabsRef === void 0 ? void 0 : (_tabsRef$current = tabsRef.current) === null || _tabsRef$current === void 0 ? void 0 : _tabsRef$current.scroll(id);
|
|
49
55
|
}
|
|
50
56
|
}, {
|
|
51
|
-
root: scrollDom ? document.querySelector(scrollDom) : null
|
|
57
|
+
root: scrollDom ? document.querySelector(scrollDom) : null,
|
|
58
|
+
rootMargin: "".concat(marginTop, " 0px ").concat(marginBottom)
|
|
59
|
+
// threshold: 0.5,
|
|
52
60
|
// rootMargin: ,
|
|
53
61
|
});
|
|
54
62
|
|
|
@@ -90,26 +98,27 @@ var TabProduct = function TabProduct(props) {
|
|
|
90
98
|
}
|
|
91
99
|
};
|
|
92
100
|
return /*#__PURE__*/React.createElement("div", {
|
|
93
|
-
className: classNames(
|
|
101
|
+
className: classNames('tab-product', warpClassName)
|
|
94
102
|
}, /*#__PURE__*/React.createElement("div", {
|
|
95
|
-
className:
|
|
103
|
+
className: 'tabs-wrap',
|
|
96
104
|
style: {
|
|
97
105
|
top: stickyTop
|
|
98
106
|
}
|
|
99
107
|
}, /*#__PURE__*/React.createElement(Card, {
|
|
100
|
-
className: classNames(
|
|
101
|
-
id: "product-category"
|
|
108
|
+
className: classNames('tabs', tabsWrapClassName),
|
|
109
|
+
id: "".concat(name || 'product', "-category")
|
|
102
110
|
}, /*#__PURE__*/React.createElement(Tabs, {
|
|
103
111
|
ref: tabsRef,
|
|
104
112
|
options: list,
|
|
105
113
|
rowKey: rowKey,
|
|
106
114
|
tab: current,
|
|
115
|
+
name: name,
|
|
107
116
|
onChange: function onChange(e) {
|
|
108
117
|
var _document, _document2;
|
|
109
|
-
var dom = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector(
|
|
110
|
-
var main = (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.querySelector(scrollDom ||
|
|
118
|
+
var dom = (_document = document) === null || _document === void 0 ? void 0 : _document.querySelector('#list-' + e);
|
|
119
|
+
var main = (_document2 = document) === null || _document2 === void 0 ? void 0 : _document2.querySelector(scrollDom || '');
|
|
111
120
|
if (dom && main) {
|
|
112
|
-
main.scrollTop = dom.offsetTop -
|
|
121
|
+
main.scrollTop = dom.offsetTop - 42;
|
|
113
122
|
}
|
|
114
123
|
handleUnObserver();
|
|
115
124
|
setCurrent(e);
|
|
@@ -118,16 +127,16 @@ var TabProduct = function TabProduct(props) {
|
|
|
118
127
|
}, 1000);
|
|
119
128
|
}
|
|
120
129
|
}))), /*#__PURE__*/React.createElement("div", {
|
|
121
|
-
className: classNames(
|
|
130
|
+
className: classNames('category-list', categoryWrapClassName)
|
|
122
131
|
}, list.map(function (d, i) {
|
|
123
132
|
return /*#__PURE__*/React.createElement("div", {
|
|
124
|
-
className:
|
|
133
|
+
className: 'category-item',
|
|
125
134
|
id: "list-".concat(d[rowKey]),
|
|
126
135
|
key: i
|
|
127
136
|
}, /*#__PURE__*/React.createElement("div", {
|
|
128
|
-
className:
|
|
137
|
+
className: 'category-title'
|
|
129
138
|
}, d.name), /*#__PURE__*/React.createElement("div", {
|
|
130
|
-
className: classNames(
|
|
139
|
+
className: classNames('product-list', listWrapClassName)
|
|
131
140
|
}, d.products.map(function (item, index) {
|
|
132
141
|
if (renderItem) {
|
|
133
142
|
return renderItem(item);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
3
|
export interface Com<T> extends React.FC<T> {
|
|
4
4
|
}
|
|
5
5
|
export declare type RowKey = string | number;
|
|
@@ -7,7 +7,7 @@ export interface Option {
|
|
|
7
7
|
id: number | string;
|
|
8
8
|
name: React.ReactNode;
|
|
9
9
|
}
|
|
10
|
-
export interface TabsProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>,
|
|
10
|
+
export interface TabsProps extends Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement>, 'onChange'> {
|
|
11
11
|
renderTab: (item: any) => React.ReactNode;
|
|
12
12
|
rowKey: RowKey;
|
|
13
13
|
name: RowKey;
|
|
@@ -4,11 +4,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
5
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
import React, { useMemo, useState, useEffect, forwardRef, useImperativeHandle } from
|
|
8
|
-
import classNames from
|
|
9
|
-
import { useDebounceFn } from
|
|
10
|
-
import ChevronLeft from
|
|
11
|
-
import ChevronRight from
|
|
7
|
+
import React, { useMemo, useState, useEffect, forwardRef, useImperativeHandle } from 'react';
|
|
8
|
+
import classNames from 'classnames';
|
|
9
|
+
import { useDebounceFn } from 'ahooks';
|
|
10
|
+
import ChevronLeft from '@pisell/icon/es/ChevronLeft';
|
|
11
|
+
import ChevronRight from '@pisell/icon/es/ChevronRight';
|
|
12
12
|
import "./index.less";
|
|
13
13
|
|
|
14
14
|
// tabs 子组件定义
|
|
@@ -17,7 +17,7 @@ var Tabs = function Tabs(_ref, ref) {
|
|
|
17
17
|
var renderTab = _ref.renderTab,
|
|
18
18
|
rowKey = _ref.rowKey,
|
|
19
19
|
_ref$name = _ref.name,
|
|
20
|
-
name = _ref$name === void 0 ?
|
|
20
|
+
name = _ref$name === void 0 ? 'tabs-' : _ref$name,
|
|
21
21
|
onChange = _ref.onChange,
|
|
22
22
|
tab = _ref.tab,
|
|
23
23
|
className = _ref.className,
|
|
@@ -58,6 +58,19 @@ var Tabs = function Tabs(_ref, ref) {
|
|
|
58
58
|
}
|
|
59
59
|
}, [options]);
|
|
60
60
|
|
|
61
|
+
/**
|
|
62
|
+
* @title: 一个页面多个tab,id会重复
|
|
63
|
+
* @description:
|
|
64
|
+
* @param {*} useMemo
|
|
65
|
+
* @return {*}
|
|
66
|
+
* @Author: WangHan
|
|
67
|
+
* @Date: 2024-07-30 11:02
|
|
68
|
+
*/
|
|
69
|
+
var _id = useMemo(function () {
|
|
70
|
+
var _id = name ? "pisell-".concat(name, "-tabs") : 'pisell-tabs';
|
|
71
|
+
return _id;
|
|
72
|
+
}, [name]);
|
|
73
|
+
|
|
61
74
|
/**
|
|
62
75
|
* @title: 判断是否展示箭头
|
|
63
76
|
* @description:
|
|
@@ -66,8 +79,8 @@ var Tabs = function Tabs(_ref, ref) {
|
|
|
66
79
|
* @Date: 2023-08-01 15:59
|
|
67
80
|
*/
|
|
68
81
|
var calculateWidth = function calculateWidth() {
|
|
69
|
-
var content = document.querySelector("#
|
|
70
|
-
var itemList = document.querySelector("#
|
|
82
|
+
var content = document.querySelector("#".concat(_id));
|
|
83
|
+
var itemList = document.querySelector("#".concat(_id, "-content"));
|
|
71
84
|
if ((itemList === null || itemList === void 0 ? void 0 : itemList.offsetWidth) + 60 < (content === null || content === void 0 ? void 0 : content.offsetWidth)) {
|
|
72
85
|
setIsShowButton(false);
|
|
73
86
|
}
|
|
@@ -126,8 +139,8 @@ var Tabs = function Tabs(_ref, ref) {
|
|
|
126
139
|
|
|
127
140
|
// 设置滚动位置
|
|
128
141
|
var setTabScroll = function setTabScroll(val) {
|
|
129
|
-
var dom = document.querySelector("#
|
|
130
|
-
console.log(
|
|
142
|
+
var dom = document.querySelector("#".concat(_id, "-content"));
|
|
143
|
+
console.log('domdom', dom);
|
|
131
144
|
if (!dom) {
|
|
132
145
|
return;
|
|
133
146
|
}
|
|
@@ -143,11 +156,11 @@ var Tabs = function Tabs(_ref, ref) {
|
|
|
143
156
|
* @Date: 2023-06-03 10:45
|
|
144
157
|
*/
|
|
145
158
|
var onPageChange = function onPageChange(type) {
|
|
146
|
-
var dom = document.querySelector("#
|
|
159
|
+
var dom = document.querySelector("#".concat(_id, "-content"));
|
|
147
160
|
if (!dom) {
|
|
148
161
|
return;
|
|
149
162
|
}
|
|
150
|
-
if (type ===
|
|
163
|
+
if (type === 'left') {
|
|
151
164
|
setTabScroll((dom === null || dom === void 0 ? void 0 : dom.scrollLeft) - dom.clientWidth / 2);
|
|
152
165
|
} else {
|
|
153
166
|
setTabScroll((dom === null || dom === void 0 ? void 0 : dom.scrollLeft) + dom.clientWidth / 2);
|
|
@@ -162,7 +175,7 @@ var Tabs = function Tabs(_ref, ref) {
|
|
|
162
175
|
width: leftWidth
|
|
163
176
|
},
|
|
164
177
|
onClick: function onClick() {
|
|
165
|
-
onPageChange(
|
|
178
|
+
onPageChange('left');
|
|
166
179
|
}
|
|
167
180
|
}, /*#__PURE__*/React.createElement(ChevronLeft, {
|
|
168
181
|
className: "pisell-tabs-btn-icon"
|
|
@@ -178,10 +191,10 @@ var Tabs = function Tabs(_ref, ref) {
|
|
|
178
191
|
className: "pisell-tabs-btn-right",
|
|
179
192
|
style: {
|
|
180
193
|
width: rightWidth,
|
|
181
|
-
marginRight: !rightWidth ?
|
|
194
|
+
marginRight: !rightWidth ? '20px' : 0
|
|
182
195
|
},
|
|
183
196
|
onClick: function onClick() {
|
|
184
|
-
onPageChange(
|
|
197
|
+
onPageChange('right');
|
|
185
198
|
}
|
|
186
199
|
}, /*#__PURE__*/React.createElement(ChevronRight, {
|
|
187
200
|
className: "pisell-tabs-btn-icon"
|
|
@@ -192,16 +205,16 @@ var Tabs = function Tabs(_ref, ref) {
|
|
|
192
205
|
var content = useMemo(function () {
|
|
193
206
|
return /*#__PURE__*/React.createElement("div", {
|
|
194
207
|
className: "pisell-tabs-content",
|
|
195
|
-
id: "
|
|
208
|
+
id: "".concat(_id, "-content"),
|
|
196
209
|
onScroll: onScroll
|
|
197
210
|
}, _options.map(function (d, i) {
|
|
198
211
|
var _key = rowKey ? d[rowKey] : i;
|
|
199
212
|
return /*#__PURE__*/React.createElement("div", {
|
|
200
|
-
className: classNames(
|
|
201
|
-
|
|
213
|
+
className: classNames('pisell-tabs-tab', {
|
|
214
|
+
'pisell-tabs-tab-active': tab === _key
|
|
202
215
|
}),
|
|
203
216
|
key: _key,
|
|
204
|
-
id: name +
|
|
217
|
+
id: name + '' + _key,
|
|
205
218
|
onClick: function onClick(e) {
|
|
206
219
|
_onChange(_key, d, e);
|
|
207
220
|
}
|
|
@@ -211,8 +224,8 @@ var Tabs = function Tabs(_ref, ref) {
|
|
|
211
224
|
}));
|
|
212
225
|
}, [_options, rowKey, name, tab]);
|
|
213
226
|
return /*#__PURE__*/React.createElement("div", {
|
|
214
|
-
className: classNames(
|
|
215
|
-
id:
|
|
227
|
+
className: classNames('pisell-tabs', className),
|
|
228
|
+
id: _id
|
|
216
229
|
}, isShowButton && leftBtn, content, isShowButton && rightBtn);
|
|
217
230
|
};
|
|
218
231
|
export default /*#__PURE__*/forwardRef(Tabs);
|
|
@@ -163,6 +163,13 @@ declare const _default: {
|
|
|
163
163
|
'pisell2.text.terminal-edit-message': string;
|
|
164
164
|
"pisell2.text.actions": string;
|
|
165
165
|
"pisell2.text.add-client": string;
|
|
166
|
+
"pisell2.schedule.tab.all": string;
|
|
167
|
+
"pisell2.schedule.tab.surcharge": string;
|
|
168
|
+
"pisell2.schedule.tab.resources": string;
|
|
169
|
+
"pisell2.schedule.tab.products": string;
|
|
170
|
+
"pisell2.schedule.tab.events": string;
|
|
171
|
+
"pisell2.schedule.tab.quotation": string;
|
|
172
|
+
"pisell2.schedule.tab.open-hours": string;
|
|
166
173
|
'pisell2.text.variant-client-change': string;
|
|
167
174
|
'pisell2.text.variant-client-no-data': string;
|
|
168
175
|
'page.event.booking.text.duplicate-enrollment': string;
|
|
@@ -351,6 +358,13 @@ declare const _default: {
|
|
|
351
358
|
'page.booking.text.unlimited': string;
|
|
352
359
|
"pisell2.text.actions": string;
|
|
353
360
|
"pisell2.text.add-client": string;
|
|
361
|
+
"pisell2.schedule.tab.all": string;
|
|
362
|
+
"pisell2.schedule.tab.surcharge": string;
|
|
363
|
+
"pisell2.schedule.tab.resources": string;
|
|
364
|
+
"pisell2.schedule.tab.products": string;
|
|
365
|
+
"pisell2.schedule.tab.events": string;
|
|
366
|
+
"pisell2.schedule.tab.quotation": string;
|
|
367
|
+
"pisell2.schedule.tab.open-hours": string;
|
|
354
368
|
'pisell2.text.variant-client-change': string;
|
|
355
369
|
'pisell2.text.variant-client-no-data': string;
|
|
356
370
|
'page.event.booking.text.duplicate-enrollment': string;
|
|
@@ -539,6 +553,13 @@ declare const _default: {
|
|
|
539
553
|
'page.booking.text.unlimited': string;
|
|
540
554
|
"pisell2.text.actions": string;
|
|
541
555
|
"pisell2.text.add-client": string;
|
|
556
|
+
"pisell2.schedule.tab.all": string;
|
|
557
|
+
"pisell2.schedule.tab.surcharge": string;
|
|
558
|
+
"pisell2.schedule.tab.resources": string;
|
|
559
|
+
"pisell2.schedule.tab.products": string;
|
|
560
|
+
"pisell2.schedule.tab.events": string;
|
|
561
|
+
"pisell2.schedule.tab.quotation": string;
|
|
562
|
+
"pisell2.schedule.tab.open-hours": string;
|
|
542
563
|
'pisell2.text.variant-client-change': string;
|
|
543
564
|
'pisell2.text.variant-client-no-data': string;
|
|
544
565
|
'page.event.booking.text.duplicate-enrollment': string;
|
|
@@ -207,6 +207,14 @@ var locales_default = {
|
|
|
207
207
|
"pisell2.text.terminal-edit-message": "This operation cannot be performed. To proceed, please use the Pisell Terminal.",
|
|
208
208
|
"pisell2.text.actions": "Actions",
|
|
209
209
|
"pisell2.text.add-client": "Add customer",
|
|
210
|
+
// 日称tab
|
|
211
|
+
"pisell2.schedule.tab.all": "All",
|
|
212
|
+
"pisell2.schedule.tab.surcharge": "Surcharge",
|
|
213
|
+
"pisell2.schedule.tab.resources": "Resources",
|
|
214
|
+
"pisell2.schedule.tab.products": "Products",
|
|
215
|
+
"pisell2.schedule.tab.events": "Events",
|
|
216
|
+
"pisell2.schedule.tab.quotation": "Quotation",
|
|
217
|
+
"pisell2.schedule.tab.open-hours": "Open hours",
|
|
210
218
|
"pisell2.text.variant-client-change": "Change",
|
|
211
219
|
"pisell2.text.variant-client-no-data": "No record",
|
|
212
220
|
"page.event.booking.text.duplicate-enrollment": "Duplicate Enrollment",
|
|
@@ -420,6 +428,14 @@ var locales_default = {
|
|
|
420
428
|
"page.booking.text.unlimited": "无限制",
|
|
421
429
|
"pisell2.text.actions": "操作选项",
|
|
422
430
|
"pisell2.text.add-client": "添加客户",
|
|
431
|
+
// 日称tab
|
|
432
|
+
"pisell2.schedule.tab.all": "全部",
|
|
433
|
+
"pisell2.schedule.tab.surcharge": "附加费",
|
|
434
|
+
"pisell2.schedule.tab.resources": "资源",
|
|
435
|
+
"pisell2.schedule.tab.products": "商品",
|
|
436
|
+
"pisell2.schedule.tab.events": "活动",
|
|
437
|
+
"pisell2.schedule.tab.quotation": "报价单",
|
|
438
|
+
"pisell2.schedule.tab.open-hours": "营业时间",
|
|
423
439
|
"pisell2.text.variant-client-change": "更改客户",
|
|
424
440
|
"pisell2.text.variant-client-no-data": "暂无数据",
|
|
425
441
|
"page.event.booking.text.duplicate-enrollment": "重复报名",
|
|
@@ -633,6 +649,14 @@ var locales_default = {
|
|
|
633
649
|
"page.booking.text.unlimited": "無限制",
|
|
634
650
|
"pisell2.text.actions": "操作選項",
|
|
635
651
|
"pisell2.text.add-client": "添加客戶",
|
|
652
|
+
// 日称tab
|
|
653
|
+
"pisell2.schedule.tab.all": "全部",
|
|
654
|
+
"pisell2.schedule.tab.surcharge": "附加費",
|
|
655
|
+
"pisell2.schedule.tab.resources": "資源",
|
|
656
|
+
"pisell2.schedule.tab.products": "商品",
|
|
657
|
+
"pisell2.schedule.tab.events": "活動",
|
|
658
|
+
"pisell2.schedule.tab.quotation": "報價單",
|
|
659
|
+
"pisell2.schedule.tab.open-hours": "營業時間",
|
|
636
660
|
"pisell2.text.variant-client-change": "更改客戶",
|
|
637
661
|
"pisell2.text.variant-client-no-data": "暫無數據",
|
|
638
662
|
"page.event.booking.text.duplicate-enrollment": "重複報名",
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import './index.less';
|
|
3
|
+
import { ScheduleItem } from '../../../type';
|
|
4
|
+
declare type Item = any;
|
|
5
|
+
interface RenderScheduleItemProps {
|
|
6
|
+
item?: Item;
|
|
7
|
+
onItemClick?: (item: ScheduleItem) => void;
|
|
8
|
+
onDelete?: (item: ScheduleItem) => void;
|
|
9
|
+
showDeleteIcon?: boolean;
|
|
10
|
+
}
|
|
11
|
+
declare const RenderScheduleItem: ({ item, onItemClick, onDelete, showDeleteIcon, }: RenderScheduleItemProps) => React.JSX.Element;
|
|
12
|
+
export default RenderScheduleItem;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/components/schedules/components/ScheduleList/RenderScheduleItem/index.tsx
|
|
30
|
+
var RenderScheduleItem_exports = {};
|
|
31
|
+
__export(RenderScheduleItem_exports, {
|
|
32
|
+
default: () => RenderScheduleItem_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(RenderScheduleItem_exports);
|
|
35
|
+
var import_react = __toESM(require("react"));
|
|
36
|
+
var import_AlertCircle = __toESM(require("@pisell/icon/es/AlertCircle"));
|
|
37
|
+
var import_antd = require("antd");
|
|
38
|
+
var import_useEngineContext = __toESM(require("../../../../../hooks/useEngineContext"));
|
|
39
|
+
var import_index = require("./index.less");
|
|
40
|
+
var import_XClose = __toESM(require("@pisell/icon/es/XClose"));
|
|
41
|
+
var RenderScheduleItem = ({
|
|
42
|
+
item,
|
|
43
|
+
onItemClick,
|
|
44
|
+
onDelete,
|
|
45
|
+
showDeleteIcon
|
|
46
|
+
}) => {
|
|
47
|
+
var _a;
|
|
48
|
+
const { appHelper } = (0, import_useEngineContext.default)();
|
|
49
|
+
return /* @__PURE__ */ import_react.default.createElement(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
key: item.id,
|
|
53
|
+
className: "pisell-lowcode__schedule-list-item",
|
|
54
|
+
onClick: () => onItemClick == null ? void 0 : onItemClick(item)
|
|
55
|
+
},
|
|
56
|
+
/* @__PURE__ */ import_react.default.createElement(
|
|
57
|
+
"div",
|
|
58
|
+
{
|
|
59
|
+
className: "pisell-lowcode__schedule-list-item-color",
|
|
60
|
+
style: { backgroundColor: item.color }
|
|
61
|
+
}
|
|
62
|
+
),
|
|
63
|
+
/* @__PURE__ */ import_react.default.createElement("div", { className: "pisell-lowcode__schedule-list-item-content" }, (_a = appHelper == null ? void 0 : appHelper.utils) == null ? void 0 : _a.translationShop(item.name)),
|
|
64
|
+
item.conflict && /* @__PURE__ */ import_react.default.createElement(import_antd.Tooltip, { title: "Days conflict with another schedule" }, /* @__PURE__ */ import_react.default.createElement(import_AlertCircle.default, { className: "pisell-lowcode__schedule-list-item-conflict" })),
|
|
65
|
+
showDeleteIcon && /* @__PURE__ */ import_react.default.createElement(
|
|
66
|
+
import_XClose.default,
|
|
67
|
+
{
|
|
68
|
+
className: "pisell-lowcode__schedule-list-item-delete",
|
|
69
|
+
onClick: (e) => {
|
|
70
|
+
e.stopPropagation();
|
|
71
|
+
onDelete == null ? void 0 : onDelete(item);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
var RenderScheduleItem_default = RenderScheduleItem;
|