layers-design-system 2.6.10 → 2.6.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.
@@ -43318,21 +43318,52 @@ Bx.errorHandler = tde;
43318
43318
  Object.defineProperty(t, "__esModule", { value: !0 }), n(Bx, t);
43319
43319
  })(SM);
43320
43320
  const nde = {
43321
+ name: "TopicItem",
43321
43322
  props: {
43322
- topic: {
43323
- type: Object
43324
- },
43325
- disabled: {
43323
+ multipleTargets: {
43326
43324
  type: Boolean
43327
43325
  },
43328
- checked: {
43329
- type: Boolean
43326
+ depth: {
43327
+ type: Number,
43328
+ default: 0
43329
+ },
43330
+ propagate: {
43331
+ type: Function
43332
+ },
43333
+ propagateIncludes: {
43334
+ type: Function
43335
+ },
43336
+ parentsTopic: {
43337
+ type: Array,
43338
+ default: () => []
43330
43339
  },
43331
43340
  isCheckedFunction: {
43332
43341
  type: Function
43333
43342
  },
43334
43343
  populateTopic: {
43335
43344
  type: Function
43345
+ },
43346
+ hasChildChecked: {
43347
+ type: Function
43348
+ },
43349
+ parentIncludes: {
43350
+ type: Array,
43351
+ default: () => []
43352
+ },
43353
+ includesMap: {
43354
+ type: Object
43355
+ },
43356
+ parentChecked: {
43357
+ type: Boolean
43358
+ },
43359
+ topic: {
43360
+ type: Object
43361
+ },
43362
+ disabled: {
43363
+ type: Boolean
43364
+ },
43365
+ checked: {
43366
+ type: Boolean
43336
43367
  }
43337
43368
  },
43338
43369
  data: function() {
@@ -43343,6 +43374,7 @@ const nde = {
43343
43374
  fetched: !1,
43344
43375
  error: !1,
43345
43376
  includes: [],
43377
+ includesMapData: {},
43346
43378
  generator: null,
43347
43379
  buffer: [],
43348
43380
  hasMore: !1,
@@ -43350,7 +43382,7 @@ const nde = {
43350
43382
  };
43351
43383
  },
43352
43384
  created() {
43353
- this.generator = this.combinedGenerator();
43385
+ this.generator = this.combinedGenerator(), this.includesMapData = this.includesMap;
43354
43386
  },
43355
43387
  watch: {
43356
43388
  async showIncludes(t) {
@@ -43363,6 +43395,12 @@ const nde = {
43363
43395
  group: "Esta turma ainda não tem alunos",
43364
43396
  tag: "Esta tag ainda não tem turmas"
43365
43397
  }[this.topic.kind];
43398
+ },
43399
+ isUserKind() {
43400
+ return this.topic.kind === "user";
43401
+ },
43402
+ chanShowCheckbox() {
43403
+ return this.multipleTargets || this.isUserKind && !this.multipleTargets;
43366
43404
  }
43367
43405
  },
43368
43406
  methods: {
@@ -43384,7 +43422,7 @@ const nde = {
43384
43422
  }
43385
43423
  },
43386
43424
  async *combinedGenerator() {
43387
- this.topic.kind === "group" ? (yield* this.fetchToGenerator("group", "member"), yield* this.fetchToGenerator("group", "user")) : yield* this.fetchToGenerator("tag");
43425
+ this.topic.kind === "group" ? (yield* this.fetchToGenerator("group", "member"), yield* this.fetchToGenerator("group", "user")) : this.topic.kind === "member" ? yield* this.fetchToGenerator("member", "user") : yield* this.fetchToGenerator("tag");
43388
43426
  },
43389
43427
  async fetchPage() {
43390
43428
  const t = this.limit;
@@ -43403,7 +43441,7 @@ const nde = {
43403
43441
  this.fetchingIncludes = !0;
43404
43442
  try {
43405
43443
  const { results: e, hasMore: n } = await this.fetchPage();
43406
- this.includes = [...t, ...e], this.hasMore = n;
43444
+ this.includes = [...t, ...e], this.includesMapData = { ...this.includesMapData, [this.topic.id]: this.includes }, this.$emit("includes", { topic: this.topic, includes: this.includes }), this.hasMore = n;
43407
43445
  } catch (e) {
43408
43446
  this.error = e, this.$notify({
43409
43447
  ...SM.errorHandler("Erro ao carregar mais."),
@@ -43415,9 +43453,6 @@ const nde = {
43415
43453
  this.fetchingIncludes = !1;
43416
43454
  }
43417
43455
  },
43418
- hasChildChecked() {
43419
- return this.checked || !this.includes ? !1 : this.includes.map(this.isCheckedFunction).some((t) => t === !0);
43420
- },
43421
43456
  color(t) {
43422
43457
  return this.disabled ? "gray-50" : {
43423
43458
  member: "purple",
@@ -43437,29 +43472,41 @@ const nde = {
43437
43472
  isChildChecked(t) {
43438
43473
  return this.isCheckedFunction(t) || this.isCheckedFunction(this.topic);
43439
43474
  },
43475
+ expandableKind() {
43476
+ return ["group", "tag", "member"].includes(this.topic.kind);
43477
+ },
43440
43478
  toggleShowIncludes() {
43441
- (this.topic.kind === "group" || this.topic.kind === "tag") && (this.showIncludes = !this.showIncludes);
43479
+ this.expandableKind && (this.showIncludes = !this.showIncludes);
43442
43480
  },
43443
43481
  updateSelectedTopics(t, e) {
43444
43482
  this.$emit("input", { topic: t, value: e });
43445
43483
  },
43446
43484
  topicIncludedChanged(t, e) {
43447
- this.checked && !e && (this.updateSelectedTopics(this.topic, !1), this.includes.forEach((n) => {
43448
- n.id !== t.id && this.updateSelectedTopics(n, !0);
43449
- })), this.updateSelectedTopics(t, e);
43485
+ this.parentsTopic.some(this.isCheckedFunction) && !e && this.parentsTopic.filter(this.isCheckedFunction).forEach((i) => {
43486
+ var s;
43487
+ this.updateSelectedTopics(i, !1), (s = this.includesMap[i.id]) == null || s.forEach((o) => {
43488
+ this.hasChildChecked(o) || this.updateSelectedTopics(o, !0);
43489
+ });
43490
+ }), this.updateSelectedTopics(t, e);
43450
43491
  }
43451
43492
  }
43452
43493
  };
43453
43494
  var ide = function() {
43454
43495
  var e = this, n = e._self._c;
43455
- return n("div", { staticClass: "topic-item-group" }, [n("div", { staticClass: "topic-item-group-header l-d-flex l-align-items-center pl-3" }, [n("div", { staticClass: "l-flex l-d-flex l-align-items-center", on: { click: function(i) {
43456
- return i.stopPropagation(), e.toggleShowIncludes();
43457
- } } }, [e.topic.kind == "group" || e.topic.kind == "tag" ? n("div", { staticClass: "topic-chevron mr-2" }, [n("l-icon", { staticClass: "gray-60--text", attrs: { size: "24" } }, [e._v(" " + e._s(e.showIncludes ? "uil-angle-down" : "uil-angle-right") + " ")])], 1) : e._e(), n("div", { staticClass: "topic-icon" }, [n("div", { staticClass: "bg-icon", class: e.color(e.topic.kind) }), n("l-icon", { class: e.color(e.topic.kind) + "--text" }, [e._v(" " + e._s(e.icon(e.topic.kind)) + " ")])], 1), n("div", { staticClass: "l-flex ml-2 mr-3 l-text-regular ellipsis-2", class: e.disabled ? "gray-70--text" : "lead-light--text" }, [e._v(" " + e._s(e.topic.name) + " ")])]), n("l-checkbox", { key: e.isCheckedFunction(e.topic), staticClass: "p-3", attrs: { disabled: e.disabled, checked: e.isCheckedFunction(e.topic), indeterminate: e.hasChildChecked() }, on: { change: function(i) {
43458
- return e.updateSelectedTopics(e.topic, i);
43459
- } } })], 1), n("hr"), n("l-transition-expand", [e.showIncludes ? n("div", { staticClass: "px-3" }, [e.initialFetching ? [n("div", { staticClass: "l-d-flex l-align-items-center my-2", staticStyle: { "justify-content": "center", width: "100%", height: "40px" } }, [n("l-circular-loader", { attrs: { width: 40, height: 40 } })], 1), n("hr")] : n("div", [!e.includes.length && !e.hasMore || e.error ? [n("div", { staticClass: "no-data-includes l-text-regular gray-60--text" }, [e._v(" " + e._s(e.includesNoData) + " ")]), n("hr")] : n("div", [e._l(e.includes, function(i) {
43460
- return n("div", { key: i.id, staticClass: "topic-item-group-includes" }, [n("div", { staticClass: "topic-item-group-header l-d-flex l-align-items-center pl-4 ml-2" }, [n("div", { staticClass: "l-flex l-d-flex l-align-items-center" }, [n("div", { staticClass: "topic-icon" }, [n("div", { staticClass: "bg-icon", class: e.color(i.kind) }), n("l-icon", { class: e.color(i.kind) + "--text" }, [e._v(e._s(e.icon(i.kind)))])], 1), n("div", { staticClass: "l-flex ml-2 mr-3 l-text-regular ellipsis-2", class: e.disabled ? "gray-70--text" : "lead-light--text" }, [e._v(" " + e._s(i.name) + " ")])]), n("l-checkbox", { key: e.isChildChecked(i), staticClass: "pl-3 py-3", attrs: { disabled: e.disabled, checked: e.isChildChecked(i) }, on: { change: function(s) {
43461
- return e.topicIncludedChanged(i, s);
43462
- } } })], 1), n("hr")]);
43496
+ return n("div", { staticClass: "topic-item-group" }, [n("div", { class: "topic-item-group-header depth-" + e.depth + " l-d-flex l-align-items-center pl-3" + (e.isUserKind && e.depth > 0 ? " user-topic-item-group-header" : "") }, [n("div", { staticClass: "l-flex l-d-flex l-align-items-center", on: { click: function(i) {
43497
+ i.stopPropagation(), e.isUserKind || e.toggleShowIncludes();
43498
+ } } }, [e.isUserKind ? e._e() : n("div", { staticClass: "topic-chevron mr-2" }, [n("l-icon", { staticClass: "gray-60--text", attrs: { size: "24" } }, [e._v(" " + e._s(e.showIncludes ? "uil-angle-down" : "uil-angle-right") + " ")])], 1), n("div", { staticClass: "topic-icon" }, [n("div", { staticClass: "bg-icon", class: e.color(e.topic.kind) }), n("l-icon", { class: e.color(e.topic.kind) + "--text" }, [e._v(" " + e._s(e.icon(e.topic.kind)) + " ")])], 1), n("div", { staticClass: "l-flex ml-2 mr-3 l-text-regular ellipsis-2", class: e.disabled ? "gray-70--text" : "lead-light--text" }, [e._v(" " + e._s(e.topic.name) + " ")])]), n("l-checkbox", { key: e.isCheckedFunction(e.topic), staticClass: "p-3", class: {
43499
+ "circular-checkbox": !e.multipleTargets
43500
+ }, style: {
43501
+ display: e.chanShowCheckbox ? "block" : "none"
43502
+ }, attrs: { disabled: e.disabled, checked: e.isCheckedFunction(e.topic), indeterminate: e.hasChildChecked(e.topic) && !e.isCheckedFunction(e.topic) }, on: { change: function(i) {
43503
+ e.parentsTopic.length ? e.topicIncludedChanged(e.topic, i) : e.updateSelectedTopics(e.topic, i);
43504
+ } } })], 1), n("hr"), n("l-transition-expand", [e.showIncludes ? n("div", [e.initialFetching ? [n("div", { staticClass: "l-d-flex l-align-items-center my-2", staticStyle: { "justify-content": "center", width: "100%", height: "40px" } }, [n("l-circular-loader", { attrs: { width: 40, height: 40 } })], 1), n("hr")] : n("div", [!e.includes.length && !e.hasMore || e.error ? [n("div", { staticClass: "no-data-includes l-text-regular gray-60--text" }, [e._v(" " + e._s(e.includesNoData) + " ")]), n("hr")] : n("div", [e._l(e.includes, function(i) {
43505
+ return n("TopicItem", { key: i.id, attrs: { propagateIncludes: e.propagateIncludes, hasChildChecked: e.hasChildChecked, isCheckedFunction: e.isChildChecked, checked: e.isChildChecked(i), depth: e.depth + 1, topic: i, parentsTopic: [...e.parentsTopic, e.topic], parentIncludes: e.includes, includesMap: e.includesMapData, parentChecked: e.checked, populateTopic: e.populateTopic, propagate: e.propagate, disabled: e.disabled, multipleTargets: e.multipleTargets }, on: { input: function(s) {
43506
+ return e.propagate(s);
43507
+ }, includes: function(s) {
43508
+ return e.propagateIncludes(s);
43509
+ } } });
43463
43510
  }), e.hasMore ? n("div", { staticClass: "mx-3 my-3" }, [n("l-button", { attrs: { loading: e.fetchingIncludes, plain: "", fill: "" }, nativeOn: { click: function(i) {
43464
43511
  return e.fetch();
43465
43512
  } } }, [e._v(" Carregar mais ")])], 1) : e._e()], 2)], 2)], 2) : e._e()])], 1);
@@ -43469,7 +43516,7 @@ var ide = function() {
43469
43516
  rde,
43470
43517
  !1,
43471
43518
  null,
43472
- "4a8fa04f",
43519
+ "982c1ee8",
43473
43520
  null,
43474
43521
  null
43475
43522
  );
@@ -43583,7 +43630,7 @@ var hde = function() {
43583
43630
  return e.updateQuery(i);
43584
43631
  }] } }), e.query.q ? n("l-icon", { staticClass: "lead-light--text cursor-pointer", attrs: { size: "16" }, on: { click: function(i) {
43585
43632
  return e.clearInput();
43586
- } } }, [e._v(" uil-times ")]) : e._e()], 1), n("l-button", { staticClass: "bold l-d-flex l-align-items-center f-14 ml-2", attrs: { disabled: !e.hasAnySelectedTopic, loading: e.loading, type: "primary" }, on: { click: function(i) {
43633
+ } } }, [e._v(" uil-times ")]) : e._e()], 1), n("l-button", { staticClass: "save-button bold l-d-flex l-align-items-center f-14 ml-2", attrs: { disabled: !e.hasAnySelectedTopic, loading: e.loading || e.typing, type: "primary" }, on: { click: function(i) {
43587
43634
  return e.save();
43588
43635
  } } }, [e._v(" Salvar ")])], 1), e.query.q || e.query.kind !== "*" ? n("div", { staticClass: "filter-kind l-d-flex px-3 pb-2" }, [n("l-radio-group", { staticClass: "l-flex-nowrap", attrs: { size: "small", separated: "", color: "lead-light" }, model: { value: e.queryKind, callback: function(i) {
43589
43636
  e.queryKind = i;
@@ -43596,7 +43643,7 @@ var hde = function() {
43596
43643
  pde,
43597
43644
  !1,
43598
43645
  null,
43599
- "132f1bf9",
43646
+ "d969ed02",
43600
43647
  null,
43601
43648
  null
43602
43649
  );
@@ -47214,6 +47261,10 @@ const Mde = {
47214
47261
  },
47215
47262
  // props
47216
47263
  props: {
47264
+ multipleTargets: {
47265
+ type: Boolean,
47266
+ default: !0
47267
+ },
47217
47268
  canSendForAll: {
47218
47269
  type: Boolean,
47219
47270
  default: !1
@@ -47237,6 +47288,7 @@ const Mde = {
47237
47288
  forAllTagChecked: !1,
47238
47289
  showSelected: !1,
47239
47290
  selectedTopics: [],
47291
+ includesMap: {},
47240
47292
  querySearchTopics: {
47241
47293
  q: null,
47242
47294
  kind: "*",
@@ -47284,6 +47336,9 @@ const Mde = {
47284
47336
  }
47285
47337
  },
47286
47338
  computed: {
47339
+ canShowSendForAll() {
47340
+ return this.canSendForAll && !this.hasQuery && this.multipleTargets;
47341
+ },
47287
47342
  searchingSpan() {
47288
47343
  return this.querySearchTopics.q ? this.querySearchTopics.q : this.querySearchTopics.kind === "*" ? "" : this.getKindNamePlural(this.querySearchTopics.kind).toLowerCase();
47289
47344
  },
@@ -47382,7 +47437,7 @@ const Mde = {
47382
47437
  }
47383
47438
  this.selectedTopics = this.alreadySelectedTopics, this.selectedTopics && this.selectedTopics.length && this.selectedTopics.find(
47384
47439
  (t) => t.id === "*" && t.kind === "tag"
47385
- ) && (this.forAllTag = !0);
47440
+ ) && this.multipleTargets && (this.forAllTag = !0);
47386
47441
  },
47387
47442
  destroyed() {
47388
47443
  this.setSelectedTopics([]);
@@ -47401,6 +47456,13 @@ const Mde = {
47401
47456
  kind: "*"
47402
47457
  });
47403
47458
  },
47459
+ updateIncludesMap({ topic: t, includes: e }) {
47460
+ this.includesMap[t.id] = e;
47461
+ },
47462
+ hasChildChecked(t) {
47463
+ const e = this.includesMap[t.id];
47464
+ return e ? e.some(this.isChecked) || e.some(this.hasChildChecked) : !1;
47465
+ },
47404
47466
  getKindName(t, e = "pt-br") {
47405
47467
  return {
47406
47468
  "pt-br": {
@@ -47533,6 +47595,8 @@ const Mde = {
47533
47595
  n.splice(e, 1), this.setSelectedTopics(n);
47534
47596
  },
47535
47597
  updateSelectedTopics({ topic: t, value: e }) {
47598
+ if (!this.multipleTargets)
47599
+ return e ? this.setSelectedTopics([t]) : this.setSelectedTopics([]);
47536
47600
  if (!e) {
47537
47601
  this.removeTopic(t);
47538
47602
  return;
@@ -47570,13 +47634,13 @@ var xde = function() {
47570
47634
  } }, nativeOn: { click: function(o) {
47571
47635
  return e.useRecentTermSearched(i);
47572
47636
  } } });
47573
- })], 2) : e._e(), e.canSendForAll && !this.hasQuery ? n("div", { staticClass: "topic-item-tag-for-all mx-3" }, [n("div", { staticClass: "l-flex lead-light--text l-text-regular" }, [e._v(" Enviar para todos ")]), n("l-checkbox", { model: { value: e.forAllTag, callback: function(i) {
47637
+ })], 2) : e._e(), e.canShowSendForAll ? n("div", { staticClass: "topic-item-tag-for-all mx-3" }, [n("div", { staticClass: "l-flex lead-light--text l-text-regular" }, [e._v(" Enviar para todos ")]), n("l-checkbox", { model: { value: e.forAllTag, callback: function(i) {
47574
47638
  e.forAllTag = i;
47575
47639
  }, expression: "forAllTag" } })], 1) : e._e(), e.total >= 1 && e.hasQuery ? n("div", { staticClass: "results-total mb-2 px-3" }, [e._v(" " + e._s(e.totalLabel) + " ")]) : e._e(), e._l(e.resultKinds, function(i) {
47576
47640
  return n("div", { key: i, staticClass: "topics-searched mb-3" }, [e.isAllEntities ? n("h6", { staticClass: "topic-kind-title gray-70--text mb-2 px-3" }, [e._v(" " + e._s(e.getKindNamePlural(i)) + " (" + e._s(e.getTopicTotal(i)) + ") ")]) : e._e(), e._l(e.getTopicHits(i), function(s) {
47577
- return n("TopicItemGroup", { key: s.id, attrs: { topic: s, populateTopic: e.populateTopic, disabled: e.forAllTagChecked, checked: e.isChecked(s), isCheckedFunction: e.isChecked }, on: { input: function(o) {
47641
+ return n("TopicItemGroup", { key: s.id, attrs: { propagateIncludes: e.updateIncludesMap, propagate: e.updateSelectedTopics, hasChildChecked: e.hasChildChecked, topic: s, parentTopic: s, populateTopic: e.populateTopic, disabled: e.forAllTagChecked, checked: e.isChecked(s), isCheckedFunction: e.isChecked, multipleTargets: e.multipleTargets }, on: { input: function(o) {
47578
47642
  return e.updateSelectedTopics(o);
47579
- } } });
47643
+ }, includes: e.updateIncludesMap } });
47580
47644
  }), e.isAllEntities && e.needShowMore(i) ? n("div", { staticClass: "m-3" }, [n("l-button", { attrs: { loading: e.loading, plain: "", fill: "" }, nativeOn: { click: function(s) {
47581
47645
  return e.filterForKind(i);
47582
47646
  } } }, [e._v(" Mostrar mais " + e._s(e.getKindNamePlural(i).toLowerCase()) + " ")])], 1) : e._e(), !e.isAllEntities && e.needShowMore(i) ? n("div", { staticClass: "m-3" }, [n("l-button", { staticClass: "ma-3", attrs: { loading: e.loadingMore, plain: "", fill: "" }, nativeOn: { click: function(s) {
@@ -47604,7 +47668,7 @@ var xde = function() {
47604
47668
  Cde,
47605
47669
  !1,
47606
47670
  null,
47607
- "4af9663b",
47671
+ "2031061c",
47608
47672
  null,
47609
47673
  null
47610
47674
  );