@cmstops/pro-compo 0.1.71 → 0.1.72

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.
@@ -78,6 +78,7 @@ const _sfc_main = defineComponent({
78
78
  cropper: { type: Boolean },
79
79
  aiImages: {},
80
80
  series: {},
81
+ thumbsMax: {},
81
82
  mediaUseType: {}
82
83
  },
83
84
  emits: ["update:dataValue", "upload"],
@@ -126,7 +127,7 @@ const _sfc_main = defineComponent({
126
127
  data = { model: 3, data: [{ url: value, thumb: value }] };
127
128
  } else if (Array.isArray(value)) {
128
129
  data = {
129
- model: value.length > 1 ? 1 : 3,
130
+ model: 99,
130
131
  data: value.map((img) => {
131
132
  return {
132
133
  url: img
@@ -148,13 +149,11 @@ const _sfc_main = defineComponent({
148
149
  },
149
150
  { immediate: true }
150
151
  );
151
- const thumbsModeList = computed({
152
- get() {
153
- return props.dataValue;
154
- },
155
- set(value) {
156
- emit("update:dataValue", value);
152
+ const thumbsLengthList = computed(() => {
153
+ if (props.thumbsMax && thumbList.value.length >= props.thumbsMax) {
154
+ return props.thumbsMax;
157
155
  }
156
+ return thumbList.value.length + 1;
158
157
  });
159
158
  const callback = (value) => {
160
159
  var _a;
@@ -171,8 +170,10 @@ const _sfc_main = defineComponent({
171
170
  temp.data = [];
172
171
  }
173
172
  if (props.mode === "thumbs") {
174
- console.log(temp);
175
- thumbsModeList.value[thumbOptionIndex.value] = temp.data[0].url;
173
+ emit(
174
+ "update:dataValue",
175
+ temp.data.map((item) => item.url)
176
+ );
176
177
  } else {
177
178
  emit("update:dataValue", JSON.stringify(temp));
178
179
  }
@@ -245,10 +246,10 @@ const _sfc_main = defineComponent({
245
246
  const _useCropper = props.mode === "doc" ? true : useCropper.value;
246
247
  if (["smiple", "thumbs"].includes(props.mode)) {
247
248
  dialogMediaSelectionShow.value = false;
248
- const medias = data.map((media) => {
249
- return { url: media.url, thumb: media.url };
250
- });
251
- styleData.value.data = medias;
249
+ const media = data[0];
250
+ const temp = JSON.parse(JSON.stringify(styleData.value.data || []));
251
+ temp[thumbOptionIndex.value] = { url: media.url, thumb: media.url };
252
+ styleData.value.data = temp;
252
253
  callback(styleData.value);
253
254
  } else if (isPcBaner || !_useCropper) {
254
255
  dialogMediaSelectionShow.value = false;
@@ -385,11 +386,11 @@ const _sfc_main = defineComponent({
385
386
  ], 4)) : createCommentVNode("v-if", true),
386
387
  createElementVNode("div", _hoisted_4, [
387
388
  ["thumbs"].includes(_ctx.mode) ? (openBlock(), createElementBlock("div", _hoisted_5, [
388
- (openBlock(true), createElementBlock(Fragment, null, renderList(thumbsModeList.value, (item, index) => {
389
+ (openBlock(true), createElementBlock(Fragment, null, renderList(thumbsLengthList.value, (item, index) => {
389
390
  return openBlock(), createBlock(_sfc_main$1, {
390
391
  key: index,
391
392
  id: `thumb-card-${index}`,
392
- data: { url: item },
393
+ data: thumbList.value[index],
393
394
  "preview-list": previewList.value,
394
395
  "thumb-model": "thumb",
395
396
  onOpen: ($event) => openDialogMediaSelection($event, index)
@@ -79,6 +79,7 @@ const _sfc_main = vue.defineComponent({
79
79
  cropper: { type: Boolean },
80
80
  aiImages: {},
81
81
  series: {},
82
+ thumbsMax: {},
82
83
  mediaUseType: {}
83
84
  },
84
85
  emits: ["update:dataValue", "upload"],
@@ -127,7 +128,7 @@ const _sfc_main = vue.defineComponent({
127
128
  data = { model: 3, data: [{ url: value, thumb: value }] };
128
129
  } else if (Array.isArray(value)) {
129
130
  data = {
130
- model: value.length > 1 ? 1 : 3,
131
+ model: 99,
131
132
  data: value.map((img) => {
132
133
  return {
133
134
  url: img
@@ -149,13 +150,11 @@ const _sfc_main = vue.defineComponent({
149
150
  },
150
151
  { immediate: true }
151
152
  );
152
- const thumbsModeList = vue.computed({
153
- get() {
154
- return props.dataValue;
155
- },
156
- set(value) {
157
- emit("update:dataValue", value);
153
+ const thumbsLengthList = vue.computed(() => {
154
+ if (props.thumbsMax && thumbList.value.length >= props.thumbsMax) {
155
+ return props.thumbsMax;
158
156
  }
157
+ return thumbList.value.length + 1;
159
158
  });
160
159
  const callback = (value) => {
161
160
  var _a;
@@ -172,8 +171,10 @@ const _sfc_main = vue.defineComponent({
172
171
  temp.data = [];
173
172
  }
174
173
  if (props.mode === "thumbs") {
175
- console.log(temp);
176
- thumbsModeList.value[thumbOptionIndex.value] = temp.data[0].url;
174
+ emit(
175
+ "update:dataValue",
176
+ temp.data.map((item) => item.url)
177
+ );
177
178
  } else {
178
179
  emit("update:dataValue", JSON.stringify(temp));
179
180
  }
@@ -246,10 +247,10 @@ const _sfc_main = vue.defineComponent({
246
247
  const _useCropper = props.mode === "doc" ? true : useCropper.value;
247
248
  if (["smiple", "thumbs"].includes(props.mode)) {
248
249
  dialogMediaSelectionShow.value = false;
249
- const medias = data.map((media) => {
250
- return { url: media.url, thumb: media.url };
251
- });
252
- styleData.value.data = medias;
250
+ const media = data[0];
251
+ const temp = JSON.parse(JSON.stringify(styleData.value.data || []));
252
+ temp[thumbOptionIndex.value] = { url: media.url, thumb: media.url };
253
+ styleData.value.data = temp;
253
254
  callback(styleData.value);
254
255
  } else if (isPcBaner || !_useCropper) {
255
256
  dialogMediaSelectionShow.value = false;
@@ -386,11 +387,11 @@ const _sfc_main = vue.defineComponent({
386
387
  ], 4)) : vue.createCommentVNode("v-if", true),
387
388
  vue.createElementVNode("div", _hoisted_4, [
388
389
  ["thumbs"].includes(_ctx.mode) ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_5, [
389
- (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(thumbsModeList.value, (item, index) => {
390
+ (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(thumbsLengthList.value, (item, index) => {
390
391
  return vue.openBlock(), vue.createBlock(card, {
391
392
  key: index,
392
393
  id: `thumb-card-${index}`,
393
- data: { url: item },
394
+ data: thumbList.value[index],
394
395
  "preview-list": previewList.value,
395
396
  "thumb-model": "thumb",
396
397
  onOpen: ($event) => openDialogMediaSelection($event, index)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmstops/pro-compo",
3
- "version": "0.1.71",
3
+ "version": "0.1.72",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "vue",