@tplc/business 0.0.38 → 0.0.39

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/CHANGELOG.md CHANGED
@@ -2,6 +2,15 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.39](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.0.38...v0.0.39) (2024-10-23)
6
+
7
+
8
+ ### ✨ Features | 新功能
9
+
10
+ * 优化 lcb-list 相关逻辑 ([c81aeb8](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/c81aeb8e0f9b3b5931f6c227133e2b7a314fa089))
11
+ * 优化 product-item 实现 ([40ad6c6](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/40ad6c6ee4beb15a66210771b2e32972484a0341))
12
+ * 修改返回按钮尺寸 ([7c946aa](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/commit/7c946aa3cd4c9d02b663044618eededa8542ba8b))
13
+
5
14
  ### [0.0.38](http://gitlab888.30jia.com.cn/bhBank/zero-code-pro/compare/v0.1.17...v0.0.38) (2024-10-22)
6
15
 
7
16
 
@@ -62,6 +62,6 @@ interface BtnComponent {
62
62
  }
63
63
 
64
64
  export const getFilterDetail = (val: string) =>
65
- uni.$lcb.http.post<LcbFilterResult>('/pageDecoration/list//detail', {
65
+ uni.$lcb.http.post<LcbFilterResult>('/pageDecoration/list/detail', {
66
66
  pageListType: val,
67
67
  })
@@ -7,7 +7,7 @@
7
7
  @query="queryList"
8
8
  use-page-scroll
9
9
  >
10
- <lcb-product v-bind="{ ...productProps }" :items="normalizeDataList" />
10
+ <lcb-product v-bind="{ ...productProps }" :listType="listType" :items="normalizeDataList" />
11
11
  </z-paging>
12
12
  </template>
13
13
 
@@ -40,9 +40,11 @@ const normalizeDataList = computed(() => {
40
40
  title: item?.productName,
41
41
  tags,
42
42
  price: item?.price,
43
+ location: item?.cityAreaName,
44
+ priceSuffix: item?.behindUnit,
43
45
  }
44
46
  })
45
- console.log('list', list)
47
+ // console.log('list', list)
46
48
 
47
49
  return list
48
50
  })
@@ -87,12 +89,12 @@ const queryList = async (page: number, limit: number) => {
87
89
  }
88
90
  }
89
91
 
90
- watch(
91
- () => dataList.value,
92
- () => {
93
- console.log('dataList', dataList.value)
94
- },
95
- )
92
+ // watch(
93
+ // () => dataList.value,
94
+ // () => {
95
+ // console.log('dataList', dataList.value)
96
+ // },
97
+ // )
96
98
  </script>
97
99
  <style lang="scss" scoped>
98
100
  .action-view {
@@ -2,8 +2,10 @@ import { LcbListInfo } from '../../api'
2
2
  import { LcbProductProps } from '../../../lcb-product/types'
3
3
  export interface PageListProps {
4
4
  emptyImage?: string
5
+ listType?: LcbProductProps['listType']
5
6
  productProps?: LcbProductProps
6
7
  }
7
8
  export interface LcbFilterListProps extends PageListProps, LcbListInfo {
8
9
  filter?: Record<string, any>
10
+ test?: any
9
11
  }
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <view v-if="info">
2
+ <view v-if="info" class="bg-gray-100">
3
3
  <wd-sticky @sticky="sticky = $event" :offset-top="0.0001">
4
4
  <view
5
5
  :class="{
@@ -67,13 +67,13 @@
67
67
  </view>
68
68
  </wd-sticky>
69
69
 
70
- <FilterList v-bind="{ ...info.listInfo, ...pageListProps, filter }" />
70
+ <FilterList v-bind="{ ...info.listInfo, listType, filter }" test2="11" />
71
71
  </view>
72
72
  </template>
73
73
 
74
74
  <script setup lang="ts">
75
75
  import { computed, inject, Ref, ref, watch } from 'vue'
76
- import { LcbListProps } from './types'
76
+ import { LcbListProps, defaultLcbListProps } from './types'
77
77
  import { FilterComponent, getFilterDetail, LcbFilterResult } from './api'
78
78
  import FilterSelect from './components/FilterSelect/index.vue'
79
79
  import TreeSelect from './components/TreeSelect/index.vue'
@@ -83,6 +83,7 @@ import FilterList from './components/FilterList/index.vue'
83
83
  import FilterTabs from './components/FilterTabs/index.vue'
84
84
  import './index.scss'
85
85
  import { FORM_KEY } from '../../constants'
86
+
86
87
  defineOptions({
87
88
  name: 'LcbList',
88
89
  options: {
@@ -93,23 +94,14 @@ defineOptions({
93
94
  })
94
95
  const form = inject<Ref<Record<string, any>>>(FORM_KEY)
95
96
  const dropMenu = ref()
96
- const props = withDefaults(defineProps<LcbListProps>(), {
97
- pageFilterType: 'hotelTravelFilter',
98
- border: true,
99
- styleMode: 'default',
100
- pageListProps: () => ({
101
- productProps: {
102
- styleGroup: 1,
103
- },
104
- }),
105
- })
97
+ const props = withDefaults(defineProps<LcbListProps>(), defaultLcbListProps as any)
106
98
  const info = ref<LcbFilterResult>()
107
99
  const filter = ref<Record<string, any>>({})
108
100
  const titleObj = ref<Record<string, any>>({})
109
101
  /** 是否悬停 */
110
102
  const sticky = ref(false)
111
103
  const showPlain = computed(() => {
112
- console.log(props.styleMode, sticky.value, 'showPlain')
104
+ // console.log(props.styleMode, sticky.value, 'showPlain')
113
105
  return props.styleMode === 'plain' && !sticky.value
114
106
  })
115
107
  watch(
@@ -1,10 +1,12 @@
1
1
  import { PageListProps } from './components/FilterList/type'
2
+ import { LcbProductProps } from '../lcb-product/types'
2
3
 
3
4
  export interface LcbListProps {
4
5
  pageFilterType?: string
5
6
  pageListProps?: PageListProps
6
7
  border?: boolean
7
8
  styleMode?: 'default' | 'plain'
9
+ listType?: LcbProductProps['listType']
8
10
  }
9
11
  export interface Option {
10
12
  label: string
@@ -20,4 +22,18 @@ export interface FilterItemProps {
20
22
  mode?: 'multiple' | 'single'
21
23
  apiPath?: string
22
24
  options?: Option[]
25
+ test?: 1
26
+ }
27
+
28
+ export const defaultLcbListProps: LcbListProps = {
29
+ pageFilterType: 'hotelTravelFilter',
30
+ border: true,
31
+ styleMode: 'default',
32
+ listType: 'grid',
33
+ // @ts-ignore
34
+ pageListProps: () => ({
35
+ productProps: {
36
+ // listType: 'list',
37
+ },
38
+ }),
23
39
  }
@@ -47,7 +47,13 @@
47
47
  </view>
48
48
  </view>
49
49
  <template v-else-if="back">
50
- <wd-icon class-prefix="lcb" name="zuo_left" @click="toBack" :color="contentColor" />
50
+ <wd-icon
51
+ class-prefix="lcb"
52
+ name="zuo_left"
53
+ @click="toBack"
54
+ :color="contentColor"
55
+ size="44rpx"
56
+ />
51
57
  </template>
52
58
  <view class="ml-2" v-if="titleLocation === 'left'">
53
59
  <Search
@@ -1,17 +1,34 @@
1
1
  <template>
2
2
  <lcb-block v-bind="$props">
3
- <template v-if="styleGroup !== 2">
4
- <view class="flex flex-col gap-2 p-2">
5
- <view v-for="(item, index) in items" :key="`${item?.productId}:${index}`">
6
- <!-- <view>{{ JSON.stringify(item) }}</view> -->
7
- <lcb-product-item v-bind="item" />
3
+ <view class="flex flex-col gap-2 p-2" v-if="listType === 'list'">
4
+ <view v-for="(item, index) in items" :key="`${item?.productId}:${index}`">
5
+ <lcb-product-item v-bind="item" />
6
+ </view>
7
+ </view>
8
+
9
+ <view class="flex p-1 flex-wrap" v-if="listType === 'grid'">
10
+ <view v-for="(item, index) in items" :key="`${item?.productId}:${index}`" class="w-1/2">
11
+ <view class="p-1 overflow-hidden">
12
+ <view class="rounded overflow-hidden h-560rpx">
13
+ <lcb-product-item
14
+ v-bind="item"
15
+ layoutType="vertical"
16
+ class="!h-560rpx"
17
+ imageClass="!h-300rpx"
18
+ />
19
+ </view>
8
20
  </view>
9
21
  </view>
10
- </template>
11
- <scroll-view v-if="styleGroup == 2" scroll-x class="w-full whitespace-nowrap">
12
- <view class="flex shrink-0">
13
- <view v-for="(item, index) in items" :key="index">
14
- <lcb-product-item :styleProps="styleProps" :idx="index" v-bind="item" />
22
+ </view>
23
+
24
+ <scroll-view v-if="listType == 'horizontal'" scroll-x>
25
+ <view class="p-2 flex gap-2 whitespace-nowrap overflow-auto flex-nowrap">
26
+ <view
27
+ v-for="(item, index) in items"
28
+ :key="`${item?.productId}:${index}`"
29
+ class="!w-66vw flex-shrink-0"
30
+ >
31
+ <lcb-product-item v-bind="item" imageClass="!w-1/2" />
15
32
  </view>
16
33
  </view>
17
34
  </scroll-view>
@@ -20,7 +37,7 @@
20
37
 
21
38
  <script setup lang="ts">
22
39
  import { computed } from 'vue'
23
- import { LcbProductProps } from './types'
40
+ import { LcbProductProps, defaultLcbProductProps } from './types'
24
41
  defineOptions({
25
42
  name: 'LcbProduct',
26
43
  options: {
@@ -29,21 +46,7 @@ defineOptions({
29
46
  styleIsolation: 'shared',
30
47
  },
31
48
  })
32
- const props = withDefaults(defineProps<LcbProductProps>(), {})
33
- const styleProps = computed(() => {
34
- // console.log('props.items', JSON.stringify(props.items))
35
- return {
36
- styleGroup: props.styleGroup,
37
- productStyle: props.productStyle,
38
- productTitle: props.productTitle,
39
- showTags: props.showTags,
40
- showPrice: props.showPrice,
41
- showScribePrice: props.showScribePrice,
42
- showCart: props.showCart,
43
- showLocation: props.showLocation,
44
- showCollection: props.showCollection,
45
- }
46
- })
49
+ const props = withDefaults(defineProps<LcbProductProps>(), defaultLcbProductProps as any)
47
50
  </script>
48
51
 
49
52
  <style lang="scss" scoped></style>
@@ -1,14 +1,10 @@
1
1
  export interface LcbProductProps {
2
2
  // Define the component's prop types here
3
- styleGroup?: 1 | 2 | 3 | 4 // 1列表 2 左右滑动 3一行两个 4瀑布流
4
- items?: Record<string, any>
5
- marginHorizontal?: number
6
- productStyle?: 'image' | 'flat' | 'card' | 'border' // 图片, 扁平, 卡片, 描边
7
- productTitle?: 0 | 1 | 2 // 0默认 1 1行 2 2行
8
- showTags?: boolean
9
- showPrice?: boolean
10
- showScribePrice?: boolean
11
- showCart?: boolean
12
- showLocation?: boolean
13
- showCollection?: boolean
3
+ listType?: 'list' | 'horizontal' | 'grid' | 'waterfall' // 1列表 2 左右滑动 3一行两个 4瀑布流
4
+ items?: Record<string, any>[]
5
+ }
6
+
7
+ export const defaultLcbProductProps: LcbProductProps = {
8
+ listType: 'list',
9
+ items: [],
14
10
  }
@@ -1,8 +1,15 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, useAttrs } from 'vue'
3
3
  import { transformValueUnit } from '../../utils/transform'
4
- import { LcbProductItemProps } from './types'
4
+ import { LcbProductItemProps, defaultLcbProductItemProps } from './types'
5
5
  import { formatJson } from '../../utils/utils'
6
+ import { createReusableTemplate } from '../../utils/createReuse'
7
+ import { isArray } from '@tplc/wot/components/common/util'
8
+
9
+ const [DefineMainContent, MainContent] = createReusableTemplate()
10
+ const [DefineSectionWrapper, SectionWrapper] = createReusableTemplate()
11
+ const [DefineSection, Section] = createReusableTemplate()
12
+ const [DefineSectionGroup, SectionGroup] = createReusableTemplate()
6
13
 
7
14
  defineOptions({
8
15
  name: 'LcbProductItem',
@@ -13,49 +20,141 @@ defineOptions({
13
20
  },
14
21
  })
15
22
 
16
- const props = withDefaults(defineProps<LcbProductItemProps>(), {
17
- layoutType: 1,
18
- priceUnit: '¥',
19
- originPriceUnit: '¥',
20
- lowestPriceUnit: '¥',
21
- })
23
+ const props = withDefaults(defineProps<LcbProductItemProps>(), defaultLcbProductItemProps)
22
24
  const attrs = useAttrs()
23
25
 
24
26
  // console.log('attrs', attrs)
25
27
  </script>
26
28
 
27
29
  <template>
28
- <view v-if="layoutType === 1" class="flex gap-2 px-2 py-3 bg-white">
29
- <view class="w-1/3 h-220rpx bg-coolgray/90 rounded-sm overflow-hidden">
30
+ <!-- 内容容器定义 -->
31
+ <DefineSectionWrapper v-slot="{ prop, $slots, class: className }">
32
+ <view
33
+ v-if="
34
+ (props?.[`${prop}Visible`] ?? true) &&
35
+ !!props?.[`${prop}`] &&
36
+ (isArray(props?.[`${prop}`]) ? props?.[`${prop}`]?.length > 0 : true)
37
+ "
38
+ :class="[className, props?.[`${prop}Class`]]"
39
+ >
40
+ <component v-if="!!$slots.default" :is="$slots.default" />
41
+ <view v-else>{{ props?.[`${prop}`] }}</view>
42
+ </view>
43
+ </DefineSectionWrapper>
44
+
45
+ <!-- 定义各个内容展示节点 -->
46
+ <DefineSection v-slot="{ prop, class: className }">
47
+ <!-- 图片 -->
48
+ <SectionWrapper v-if="prop === 'image'" prop="image" :class="className">
30
49
  <image :src="image" class="w-full h-full" mode="aspectFill" />
50
+ </SectionWrapper>
51
+
52
+ <!-- 标题 -->
53
+ <SectionWrapper
54
+ :class="className"
55
+ v-if="prop === 'title'"
56
+ prop="title"
57
+ class="text-ellipsis line-clamp-2"
58
+ />
59
+
60
+ <!-- 位置 -->
61
+ <SectionWrapper
62
+ :class="className"
63
+ v-if="prop === 'location'"
64
+ prop="location"
65
+ class="text-gray-500 text-22rpx flex gap-3rpx items-center"
66
+ >
67
+ <wd-icon name="location" size="32rpx"></wd-icon>
68
+ <view>{{ location }}</view>
69
+ </SectionWrapper>
70
+
71
+ <!-- 标签 -->
72
+ <SectionWrapper
73
+ :class="className"
74
+ v-if="prop === 'tags'"
75
+ prop="tags"
76
+ class="flex gap-1 whitespace-nowrap overflow-auto"
77
+ >
78
+ <wd-tag
79
+ v-for="tag in tags"
80
+ :key="tag"
81
+ class="!text-20rpx"
82
+ :class="tagsClass"
83
+ plain
84
+ type="primary"
85
+ >
86
+ {{ tag }}
87
+ </wd-tag>
88
+ </SectionWrapper>
89
+
90
+ <!-- 价格单位 -->
91
+ <SectionWrapper
92
+ :class="className"
93
+ v-if="prop === 'priceUnit'"
94
+ prop="priceUnit"
95
+ class="text-red-500 font-bold text-22rpx"
96
+ />
97
+
98
+ <!-- 价格 -->
99
+ <SectionWrapper
100
+ :class="className"
101
+ v-if="prop === 'price'"
102
+ prop="price"
103
+ class="text-red-500 font-bold text-27rpx"
104
+ />
105
+
106
+ <!-- 价格后缀 -->
107
+ <SectionWrapper
108
+ :class="className"
109
+ v-if="prop === 'priceSuffix'"
110
+ prop="priceSuffix"
111
+ class="text-22rpx"
112
+ />
113
+
114
+ <!-- 价格区域 -->
115
+ </DefineSection>
116
+
117
+ <!-- 内容组定义 -->
118
+ <DefineSectionGroup v-slot="{ group, class: className }">
119
+ <view :class="className">
120
+ <Section v-for="prop in group" :prop="prop" :key="prop" />
31
121
  </view>
32
- <view class="flex flex-col flex-1 justify-between text-26rpx overflow-hidden">
33
- <view class="flex flex-col gap-2 overflow-hidden">
34
- <view>{{ title ?? attrs?.productName }}</view>
35
- <view v-if="tags?.length > 0" class="flex gap-1 whitespace-nowrap overflow-auto">
36
- <wd-tag v-for="tag in tags" :key="tag" class="!text-20rpx" plain type="primary">
37
- {{ tag }}
38
- </wd-tag>
39
- </view>
40
- </view>
122
+ </DefineSectionGroup>
123
+
124
+ <!-- 主内容的展示节点 -->
125
+ <DefineMainContent v-slot="{ class: className }">
126
+ <view
127
+ :class="className"
128
+ class="flex flex-col flex-1 gap-2 justify-between text-26rpx overflow-hidden"
129
+ >
130
+ <SectionGroup
131
+ class="flex flex-col gap-2 overflow-hidden"
132
+ :group="['title', 'location', 'tags']"
133
+ />
41
134
  <view class="flex gap-2">
42
- <view class="flex gap-[3rpx] items-end">
43
- <view class="text-red font-bold">{{ priceUnit }}</view>
44
- <view class="text-red font-bold">{{ price }}</view>
45
- <view v-if="!!attrs?.behindUnit" class="text-22rpx">{{ attrs?.behindUnit }}</view>
46
- </view>
135
+ <SectionGroup
136
+ class="flex gap-[4rpx] items-end"
137
+ :group="['priceUnit', 'price', 'priceSuffix']"
138
+ />
47
139
  </view>
48
140
  </view>
141
+ </DefineMainContent>
142
+
143
+ <!-- 横向布局 -->
144
+ <view
145
+ v-if="layoutType === 'horizontal'"
146
+ :class="attrs?.class"
147
+ class="flex gap-3 px-2 py-3 bg-white"
148
+ >
149
+ <Section prop="image" class="w-1/3 h-220rpx bg-gray-100 rounded-sm overflow-hidden" />
150
+ <MainContent />
49
151
  </view>
50
152
 
51
- <!-- <view v-if="layoutType === 2" class="flex flex-col gap-2 p-2 bg-white">
52
- <view class="overflow-hidden">
53
- <image :src="image" class="w-full" mode="widthFix" />
54
- </view>
55
- <view class="flex flex-col flex-1 text-26rpx">
56
- <view>{{ title ?? attrs?.productName }}</view>
57
- </view>
58
- </view> -->
153
+ <!-- 竖向布局 -->
154
+ <view v-if="layoutType === 'vertical'" :class="attrs?.class" class="flex flex-col gap-2 bg-white">
155
+ <Section prop="image" class="overflow-hidden" />
156
+ <MainContent class="p-2" />
157
+ </view>
59
158
  </template>
60
159
 
61
160
  <style lang="scss" scoped></style>
@@ -1,16 +1,58 @@
1
1
  export interface LcbProductItemProps {
2
2
  // Define the component's prop types here
3
- layoutType?: 1 | 2 // 1 横向、2 纵向
3
+
4
+ layoutType?: 'vertical' | 'horizontal'
4
5
  image?: any
5
6
  title?: any
6
7
  subTitle?: any
7
8
  price?: any
8
9
  priceUnit?: any
10
+ priceSuffix?: any
9
11
  originPrice?: any
10
12
  originPriceUnit?: any
11
- lowestPrice?: any
12
- lowestPriceUnit?: any
13
13
  tags?: any
14
14
  location?: any
15
15
  distance?: any
16
+
17
+ imageVisible?: boolean
18
+ titleVisible?: boolean
19
+ subTitleVisible?: boolean
20
+ priceVisible?: boolean
21
+ priceUnitVisible?: boolean
22
+ priceSuffixVisible?: boolean
23
+ originPriceVisible?: boolean
24
+ originPriceUnitVisible?: boolean
25
+ tagsVisible?: boolean
26
+ locationVisible?: boolean
27
+ distanceVisible?: boolean
28
+
29
+ imageClass?: string
30
+ titleClass?: string
31
+ subTitleClass?: string
32
+ priceClass?: string
33
+ priceUnitClass?: string
34
+ priceSuffixClass?: string
35
+ originPriceClass?: string
36
+ originPriceUnitClass?: string
37
+ tagsClass?: string
38
+ tagsWrapperClass?: string
39
+ locationClass?: string
40
+ distanceClass?: string
41
+ }
42
+
43
+ export const defaultLcbProductItemProps: LcbProductItemProps = {
44
+ layoutType: 'horizontal',
45
+ priceUnit: '¥',
46
+ originPriceUnit: '¥',
47
+ imageVisible: true,
48
+ titleVisible: true,
49
+ subTitleVisible: true,
50
+ priceVisible: true,
51
+ priceUnitVisible: true,
52
+ priceSuffixVisible: true,
53
+ originPriceVisible: true,
54
+ originPriceUnitVisible: true,
55
+ tagsVisible: true,
56
+ locationVisible: true,
57
+ distanceVisible: true,
16
58
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tplc/business",
3
- "version": "0.0.38",
3
+ "version": "0.0.39",
4
4
  "keywords": [
5
5
  "业务组件"
6
6
  ],
@@ -2,8 +2,10 @@ import { LcbListInfo } from '../../api'
2
2
  import { LcbProductProps } from '../../../lcb-product/types'
3
3
  export interface PageListProps {
4
4
  emptyImage?: string
5
+ listType?: LcbProductProps['listType']
5
6
  productProps?: LcbProductProps
6
7
  }
7
8
  export interface LcbFilterListProps extends PageListProps, LcbListInfo {
8
9
  filter?: Record<string, any>
10
+ test?: any
9
11
  }
@@ -1,19 +1,7 @@
1
1
  import { LcbListProps } from './types'
2
2
  import './index.scss'
3
3
  declare const _default: import('vue').DefineComponent<
4
- __VLS_WithDefaults<
5
- __VLS_TypePropsToOption<LcbListProps>,
6
- {
7
- pageFilterType: string
8
- border: boolean
9
- styleMode: string
10
- pageListProps: () => {
11
- productProps: {
12
- styleGroup: number
13
- }
14
- }
15
- }
16
- >,
4
+ __VLS_WithDefaults<__VLS_TypePropsToOption<LcbListProps>, any>,
17
5
  {},
18
6
  unknown,
19
7
  {},
@@ -24,27 +12,14 @@ declare const _default: import('vue').DefineComponent<
24
12
  string,
25
13
  import('vue').PublicProps,
26
14
  Readonly<
27
- import('vue').ExtractPropTypes<
28
- __VLS_WithDefaults<
29
- __VLS_TypePropsToOption<LcbListProps>,
30
- {
31
- pageFilterType: string
32
- border: boolean
33
- styleMode: string
34
- pageListProps: () => {
35
- productProps: {
36
- styleGroup: number
37
- }
38
- }
39
- }
40
- >
41
- >
15
+ import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<LcbListProps>, any>>
42
16
  >,
43
17
  {
44
- border: boolean
18
+ listType: 'horizontal' | 'list' | 'grid' | 'waterfall'
45
19
  pageFilterType: string
46
- pageListProps: import('./components/FilterList/type').PageListProps
20
+ border: boolean
47
21
  styleMode: 'default' | 'plain'
22
+ pageListProps: import('./components/FilterList/type').PageListProps
48
23
  },
49
24
  {}
50
25
  >
@@ -1,9 +1,11 @@
1
1
  import { PageListProps } from './components/FilterList/type'
2
+ import { LcbProductProps } from '../lcb-product/types'
2
3
  export interface LcbListProps {
3
4
  pageFilterType?: string
4
5
  pageListProps?: PageListProps
5
6
  border?: boolean
6
7
  styleMode?: 'default' | 'plain'
8
+ listType?: LcbProductProps['listType']
7
9
  }
8
10
  export interface Option {
9
11
  label: string
@@ -18,4 +20,6 @@ export interface FilterItemProps {
18
20
  mode?: 'multiple' | 'single'
19
21
  apiPath?: string
20
22
  options?: Option[]
23
+ test?: 1
21
24
  }
25
+ export declare const defaultLcbListProps: LcbListProps
@@ -1,6 +1,6 @@
1
1
  import { LcbProductProps } from './types'
2
2
  declare const _default: import('vue').DefineComponent<
3
- __VLS_WithDefaults<__VLS_TypePropsToOption<LcbProductProps>, {}>,
3
+ __VLS_WithDefaults<__VLS_TypePropsToOption<LcbProductProps>, any>,
4
4
  {},
5
5
  unknown,
6
6
  {},
@@ -11,9 +11,14 @@ declare const _default: import('vue').DefineComponent<
11
11
  string,
12
12
  import('vue').PublicProps,
13
13
  Readonly<
14
- import('vue').ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<LcbProductProps>, {}>>
14
+ import('vue').ExtractPropTypes<
15
+ __VLS_WithDefaults<__VLS_TypePropsToOption<LcbProductProps>, any>
16
+ >
15
17
  >,
16
- {},
18
+ {
19
+ items: Record<string, any>[]
20
+ listType: 'list' | 'horizontal' | 'grid' | 'waterfall'
21
+ },
17
22
  {}
18
23
  >
19
24
  export default _default
@@ -1,13 +1,5 @@
1
1
  export interface LcbProductProps {
2
- styleGroup?: 1 | 2 | 3 | 4
3
- items?: Record<string, any>
4
- marginHorizontal?: number
5
- productStyle?: 'image' | 'flat' | 'card' | 'border'
6
- productTitle?: 0 | 1 | 2
7
- showTags?: boolean
8
- showPrice?: boolean
9
- showScribePrice?: boolean
10
- showCart?: boolean
11
- showLocation?: boolean
12
- showCollection?: boolean
2
+ listType?: 'list' | 'horizontal' | 'grid' | 'waterfall'
3
+ items?: Record<string, any>[]
13
4
  }
5
+ export declare const defaultLcbProductProps: LcbProductProps
@@ -1,14 +1,6 @@
1
1
  import { LcbProductItemProps } from './types'
2
2
  declare const _default: import('vue').DefineComponent<
3
- __VLS_WithDefaults<
4
- __VLS_TypePropsToOption<LcbProductItemProps>,
5
- {
6
- layoutType: number
7
- priceUnit: string
8
- originPriceUnit: string
9
- lowestPriceUnit: string
10
- }
11
- >,
3
+ __VLS_WithDefaults<__VLS_TypePropsToOption<LcbProductItemProps>, LcbProductItemProps>,
12
4
  {},
13
5
  unknown,
14
6
  {},
@@ -20,22 +12,45 @@ declare const _default: import('vue').DefineComponent<
20
12
  import('vue').PublicProps,
21
13
  Readonly<
22
14
  import('vue').ExtractPropTypes<
23
- __VLS_WithDefaults<
24
- __VLS_TypePropsToOption<LcbProductItemProps>,
25
- {
26
- layoutType: number
27
- priceUnit: string
28
- originPriceUnit: string
29
- lowestPriceUnit: string
30
- }
31
- >
15
+ __VLS_WithDefaults<__VLS_TypePropsToOption<LcbProductItemProps>, LcbProductItemProps>
32
16
  >
33
17
  >,
34
18
  {
35
- layoutType: 1 | 2
19
+ title: any
20
+ image: any
21
+ location: any
22
+ layoutType: 'vertical' | 'horizontal'
23
+ imageClass: string
24
+ subTitle: any
25
+ price: any
36
26
  priceUnit: any
27
+ priceSuffix: any
28
+ originPrice: any
37
29
  originPriceUnit: any
38
- lowestPriceUnit: any
30
+ tags: any
31
+ distance: any
32
+ imageVisible: boolean
33
+ titleVisible: boolean
34
+ subTitleVisible: boolean
35
+ priceVisible: boolean
36
+ priceUnitVisible: boolean
37
+ priceSuffixVisible: boolean
38
+ originPriceVisible: boolean
39
+ originPriceUnitVisible: boolean
40
+ tagsVisible: boolean
41
+ locationVisible: boolean
42
+ distanceVisible: boolean
43
+ titleClass: string
44
+ subTitleClass: string
45
+ priceClass: string
46
+ priceUnitClass: string
47
+ priceSuffixClass: string
48
+ originPriceClass: string
49
+ originPriceUnitClass: string
50
+ tagsClass: string
51
+ tagsWrapperClass: string
52
+ locationClass: string
53
+ distanceClass: string
39
54
  },
40
55
  {}
41
56
  >
@@ -1,15 +1,38 @@
1
1
  export interface LcbProductItemProps {
2
- layoutType?: 1 | 2
2
+ layoutType?: 'vertical' | 'horizontal'
3
3
  image?: any
4
4
  title?: any
5
5
  subTitle?: any
6
6
  price?: any
7
7
  priceUnit?: any
8
+ priceSuffix?: any
8
9
  originPrice?: any
9
10
  originPriceUnit?: any
10
- lowestPrice?: any
11
- lowestPriceUnit?: any
12
11
  tags?: any
13
12
  location?: any
14
13
  distance?: any
14
+ imageVisible?: boolean
15
+ titleVisible?: boolean
16
+ subTitleVisible?: boolean
17
+ priceVisible?: boolean
18
+ priceUnitVisible?: boolean
19
+ priceSuffixVisible?: boolean
20
+ originPriceVisible?: boolean
21
+ originPriceUnitVisible?: boolean
22
+ tagsVisible?: boolean
23
+ locationVisible?: boolean
24
+ distanceVisible?: boolean
25
+ imageClass?: string
26
+ titleClass?: string
27
+ subTitleClass?: string
28
+ priceClass?: string
29
+ priceUnitClass?: string
30
+ priceSuffixClass?: string
31
+ originPriceClass?: string
32
+ originPriceUnitClass?: string
33
+ tagsClass?: string
34
+ tagsWrapperClass?: string
35
+ locationClass?: string
36
+ distanceClass?: string
15
37
  }
38
+ export declare const defaultLcbProductItemProps: LcbProductItemProps
@@ -0,0 +1,59 @@
1
+ import type { DefineComponent, Slot } from 'vue'
2
+ type ObjectLiteralWithPotentialObjectLiterals = Record<string, Record<string, any> | undefined>
3
+ type GenerateSlotsFromSlotMap<T extends ObjectLiteralWithPotentialObjectLiterals> = {
4
+ [K in keyof T]: Slot<T[K]>
5
+ }
6
+ export type DefineTemplateComponent<
7
+ Bindings extends Record<string, any>,
8
+ MapSlotNameToSlotProps extends ObjectLiteralWithPotentialObjectLiterals,
9
+ > = DefineComponent & {
10
+ new (): {
11
+ $slots: {
12
+ default: (
13
+ _: Bindings & {
14
+ $slots: GenerateSlotsFromSlotMap<MapSlotNameToSlotProps>
15
+ },
16
+ ) => any
17
+ }
18
+ }
19
+ }
20
+ export type ReuseTemplateComponent<
21
+ Bindings extends Record<string, any>,
22
+ MapSlotNameToSlotProps extends ObjectLiteralWithPotentialObjectLiterals,
23
+ > = DefineComponent<Bindings> & {
24
+ new (): {
25
+ $slots: GenerateSlotsFromSlotMap<MapSlotNameToSlotProps>
26
+ }
27
+ }
28
+ export type ReusableTemplatePair<
29
+ Bindings extends Record<string, any>,
30
+ MapSlotNameToSlotProps extends ObjectLiteralWithPotentialObjectLiterals,
31
+ > = [
32
+ DefineTemplateComponent<Bindings, MapSlotNameToSlotProps>,
33
+ ReuseTemplateComponent<Bindings, MapSlotNameToSlotProps>,
34
+ ] & {
35
+ define: DefineTemplateComponent<Bindings, MapSlotNameToSlotProps>
36
+ reuse: ReuseTemplateComponent<Bindings, MapSlotNameToSlotProps>
37
+ }
38
+ export interface CreateReusableTemplateOptions {
39
+ /**
40
+ * Inherit attrs from reuse component.
41
+ *
42
+ * @default true
43
+ */
44
+ inheritAttrs?: boolean
45
+ }
46
+ /**
47
+ * This function creates `define` and `reuse` components in pair,
48
+ * It also allow to pass a generic to bind with type.
49
+ *
50
+ * @see https://vueuse.org/createReusableTemplate
51
+ */
52
+ export declare function createReusableTemplate<
53
+ Bindings extends Record<string, any>,
54
+ MapSlotNameToSlotProps extends ObjectLiteralWithPotentialObjectLiterals = Record<
55
+ 'default',
56
+ undefined
57
+ >,
58
+ >(options?: CreateReusableTemplateOptions): ReusableTemplatePair<Bindings, MapSlotNameToSlotProps>
59
+ export {}
@@ -0,0 +1,121 @@
1
+ import type { DefineComponent, Slot } from 'vue'
2
+ import { defineComponent, shallowRef } from 'vue'
3
+
4
+ type ObjectLiteralWithPotentialObjectLiterals = Record<string, Record<string, any> | undefined>
5
+
6
+ type GenerateSlotsFromSlotMap<T extends ObjectLiteralWithPotentialObjectLiterals> = {
7
+ [K in keyof T]: Slot<T[K]>
8
+ }
9
+
10
+ export type DefineTemplateComponent<
11
+ Bindings extends Record<string, any>,
12
+ MapSlotNameToSlotProps extends ObjectLiteralWithPotentialObjectLiterals,
13
+ > = DefineComponent & {
14
+ new (): {
15
+ $slots: {
16
+ default: (_: Bindings & { $slots: GenerateSlotsFromSlotMap<MapSlotNameToSlotProps> }) => any
17
+ }
18
+ }
19
+ }
20
+
21
+ export type ReuseTemplateComponent<
22
+ Bindings extends Record<string, any>,
23
+ MapSlotNameToSlotProps extends ObjectLiteralWithPotentialObjectLiterals,
24
+ > = DefineComponent<Bindings> & {
25
+ new (): { $slots: GenerateSlotsFromSlotMap<MapSlotNameToSlotProps> }
26
+ }
27
+
28
+ export type ReusableTemplatePair<
29
+ Bindings extends Record<string, any>,
30
+ MapSlotNameToSlotProps extends ObjectLiteralWithPotentialObjectLiterals,
31
+ > = [
32
+ DefineTemplateComponent<Bindings, MapSlotNameToSlotProps>,
33
+ ReuseTemplateComponent<Bindings, MapSlotNameToSlotProps>,
34
+ ] & {
35
+ define: DefineTemplateComponent<Bindings, MapSlotNameToSlotProps>
36
+ reuse: ReuseTemplateComponent<Bindings, MapSlotNameToSlotProps>
37
+ }
38
+
39
+ export interface CreateReusableTemplateOptions {
40
+ /**
41
+ * Inherit attrs from reuse component.
42
+ *
43
+ * @default true
44
+ */
45
+ inheritAttrs?: boolean
46
+ }
47
+
48
+ /**
49
+ * This function creates `define` and `reuse` components in pair,
50
+ * It also allow to pass a generic to bind with type.
51
+ *
52
+ * @see https://vueuse.org/createReusableTemplate
53
+ */
54
+ export function createReusableTemplate<
55
+ Bindings extends Record<string, any>,
56
+ MapSlotNameToSlotProps extends ObjectLiteralWithPotentialObjectLiterals = Record<
57
+ 'default',
58
+ undefined
59
+ >,
60
+ >(
61
+ options: CreateReusableTemplateOptions = {},
62
+ ): ReusableTemplatePair<Bindings, MapSlotNameToSlotProps> {
63
+ const { inheritAttrs = true } = options
64
+
65
+ const render = shallowRef<Slot | undefined>()
66
+
67
+ const define = defineComponent({
68
+ setup(_, { slots }) {
69
+ return () => {
70
+ render.value = slots.default
71
+ }
72
+ },
73
+ }) as unknown as DefineTemplateComponent<Bindings, MapSlotNameToSlotProps>
74
+
75
+ const reuse = defineComponent({
76
+ inheritAttrs,
77
+ setup(_, { attrs, slots }) {
78
+ return () => {
79
+ if (!render.value && process.env.NODE_ENV !== 'production')
80
+ throw new Error('[VueUse] Failed to find the definition of reusable template')
81
+ const vnode = render.value?.({ ...keysToCamelKebabCase(attrs), $slots: slots })
82
+
83
+ return inheritAttrs && vnode?.length === 1 ? vnode[0] : vnode
84
+ }
85
+ },
86
+ }) as unknown as ReuseTemplateComponent<Bindings, MapSlotNameToSlotProps>
87
+
88
+ return makeDestructurable({ define, reuse }, [define, reuse]) as any
89
+ }
90
+
91
+ function keysToCamelKebabCase(obj: Record<string, any>) {
92
+ const newObj: typeof obj = {}
93
+ for (const key in obj) newObj[camelize(key)] = obj[key]
94
+ return newObj
95
+ }
96
+ /**
97
+ * @see What the hack? https://antfu.me/posts/destructuring-with-object-or-array
98
+ */
99
+ function makeDestructurable<T extends Record<string, unknown>, A extends readonly any[]>(
100
+ obj: T,
101
+ arr: A,
102
+ ): T & A {
103
+ const clone = { ...obj }
104
+ Object.defineProperty(clone, Symbol.iterator, {
105
+ enumerable: false,
106
+ value() {
107
+ let index = 0
108
+ return {
109
+ next: () => ({
110
+ value: arr[index++],
111
+ done: index > arr.length,
112
+ }),
113
+ }
114
+ },
115
+ })
116
+ return clone as T & A
117
+ }
118
+
119
+ function camelize(str: string) {
120
+ return str.replace(/-(\w)/g, (_, c) => (c ? c.toUpperCase() : ''))
121
+ }