@social-mail/social-mail-client 1.2.374 → 1.2.375

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.
@@ -20010,10 +20010,10 @@ System.register(["../../common/apiPath", "../../common/toBase36"], function (_ex
20010
20010
 
20011
20011
  AmdLoader.instance.setup("@social-mail/social-mail-client/dist/public/store/storeItemLink");
20012
20012
 
20013
- System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/style/styled", "@web-atoms/core/dist/web/controls/AtomControl", "@web-atoms/web-controls/dist/basic/AtomRepeater", "../../common/controls/repeater/InfiniteRepeater", "@web-atoms/core/dist/core/InjectProperty", "../../services/EntityService", "../../model/model", "../../common/Sql", "../../common/apiPath", "../../common/currency", "./storeItemLink"], function (_export, _context) {
20013
+ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dist/core/XNode", "@web-atoms/core/dist/style/styled", "@web-atoms/core/dist/web/controls/AtomControl", "@web-atoms/web-controls/dist/basic/AtomRepeater", "../../common/controls/repeater/InfiniteRepeater", "@web-atoms/core/dist/core/InjectProperty", "../../services/EntityService", "../../model/model", "../../common/Sql", "../../common/apiPath", "../../common/currency", "./storeItemLink", "@web-atoms/core/dist/view-model/Action"], function (_export, _context) {
20014
20014
  "use strict";
20015
20015
 
20016
- var __awaiter, __decorate, __metadata, Bind, XNode, styled, AtomControl, AtomRepeater, InfiniteRepeater, InjectProperty, EntityService, StoreItem, StoreMediaFile, StoreTag, Sql, apiPath, formatPrice, storeItemLink, StoreItemListView;
20016
+ var __awaiter, __decorate, __metadata, Bind, XNode, styled, AtomControl, AtomRepeater, InfiniteRepeater, InjectProperty, EntityService, StoreItem, StoreMediaFile, StoreTag, Sql, apiPath, formatPrice, storeItemLink, Action, StoreItemListView;
20017
20017
  _export("default", void 0);
20018
20018
  return {
20019
20019
  setters: [function (_tslib) {
@@ -20048,6 +20048,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
20048
20048
  formatPrice = _commonCurrency.formatPrice;
20049
20049
  }, function (_storeItemLink) {
20050
20050
  storeItemLink = _storeItemLink.storeItemLink;
20051
+ }, function (_webAtomsCoreDistViewModelAction) {
20052
+ Action = _webAtomsCoreDistViewModelAction.default;
20051
20053
  }],
20052
20054
  execute: function () {
20053
20055
  styled.css`
@@ -20141,6 +20143,8 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
20141
20143
  super(app, e);
20142
20144
  this.search = "";
20143
20145
  this.items = [];
20146
+ this.tags = [];
20147
+ this.version = 0;
20144
20148
  this.element.setAttribute("data-shopping-cart-list", "shopping-cart-list");
20145
20149
  this.runAfterInit(() => this.app.runAsync(() => this.init()));
20146
20150
  }
@@ -20148,23 +20152,36 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
20148
20152
  return __awaiter(this, void 0, void 0, function* () {
20149
20153
  this.render(XNode.create("div", {
20150
20154
  "data-shopping-cart-list": "shopping-cart-list"
20151
- }, XNode.create("header", null, XNode.create("input", {
20155
+ }, XNode.create("header", null, XNode.create(AtomRepeater, {
20156
+ class: "search-tags",
20157
+ items: this.tags,
20158
+ itemRenderer: x => XNode.create("div", {
20159
+ "data-layout": "row"
20160
+ }, " ", XNode.create("label", {
20161
+ text: `${x.tag.label} (${x.count})`
20162
+ }), " ", XNode.create("i", {
20163
+ "data-click-event": "remove-tag",
20164
+ class: "fas fa-times-circle"
20165
+ }), " ")
20166
+ }), XNode.create("input", {
20152
20167
  type: "search",
20153
20168
  value: Bind.twoWaysImmediate(() => this.search)
20154
20169
  }), XNode.create(AtomRepeater, {
20155
20170
  class: "tags",
20156
- items: Bind.oneWayAsync((c, e, cancelToken) => this.searchTags(this.search, cancelToken), {
20171
+ items: Bind.oneWayAsync((c, e, cancelToken) => this.searchTags(this.search, cancelToken, this.version), {
20157
20172
  default: []
20158
20173
  }),
20159
20174
  itemRenderer: x => XNode.create("label", {
20160
20175
  text: `${x.tag.label} (${x.count})`
20161
- })
20176
+ }),
20177
+ "data-click-event": "select-tag"
20162
20178
  })), XNode.create(AtomRepeater, Object.assign({
20163
20179
  for: "section",
20164
20180
  items: this.items
20165
20181
  }, InfiniteRepeater.pagedItems(start => (c, e, cancelToken) => this.searchItems({
20166
20182
  start,
20167
20183
  search: this.search,
20184
+ version: this.version,
20168
20185
  cancelToken
20169
20186
  })), {
20170
20187
  itemRenderer: item => XNode.create("div", {
@@ -20191,7 +20208,18 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
20191
20208
  })), XNode.create("footer", null)));
20192
20209
  });
20193
20210
  }
20194
- searchTags(search, cancelToken) {
20211
+ removeTag(tag) {
20212
+ this.tags.remove(tag);
20213
+ this.version++;
20214
+ }
20215
+ selectTag(tag) {
20216
+ if (this.tags.find(t => t.tagID === tag.tagID)) {
20217
+ return;
20218
+ }
20219
+ this.tags.add(tag);
20220
+ this.version++;
20221
+ }
20222
+ searchTags(search, cancelToken, v) {
20195
20223
  return __awaiter(this, void 0, void 0, function* () {
20196
20224
  let q = this.entityService.query(StoreTag, "storeQuery");
20197
20225
  if (search) {
@@ -20200,6 +20228,12 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
20200
20228
  search
20201
20229
  }, p => x => (Sql.text.like(x.tag.lowerCaseName, p.search) || Sql.text.like(x.tag.parent.lowerCaseName, p.search)) && x.count > 0);
20202
20230
  }
20231
+ if (this.tags.length) {
20232
+ const ids = this.tags.map(t => t.tagID);
20233
+ q = q.where({
20234
+ ids
20235
+ }, p => x => !Sql.in(x.tagID, p.ids));
20236
+ }
20203
20237
  const tags = yield q.orderByDescending(x => x.count).include(x => x.tag).toPagedList({
20204
20238
  size: 10,
20205
20239
  cancelToken
@@ -20217,6 +20251,7 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
20217
20251
  start,
20218
20252
  search = "",
20219
20253
  size = 50,
20254
+ version = 0,
20220
20255
  cancelToken
20221
20256
  }) {
20222
20257
  var _a;
@@ -20230,6 +20265,12 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
20230
20265
  lowerSearch
20231
20266
  }, p => x => Sql.text.iLike(x.name, p.search) || Sql.text.iLike(x.description, p.search) || x.sizes.some(s => Sql.text.iLike(s.name, p.search) || Sql.text.iLike(s.description, p.search)) || x.variants.some(s => Sql.text.iLike(s.name, p.search) || Sql.text.iLike(s.description, p.search)) || x.storeItemTags.some(t => Sql.text.like(t.tag.lowerCaseName, p.lowerSearch) || Sql.text.like(t.tag.parent.lowerCaseName, p.lowerSearch)));
20232
20267
  }
20268
+ if (this.tags.length) {
20269
+ const ids = this.tags.map(t => t.tagID);
20270
+ q = q.where({
20271
+ ids
20272
+ }, p => x => x.storeItemTags.some(st => Sql.in(st.tagID, p.ids)));
20273
+ }
20233
20274
  const items = yield q.orderByDescending(x => x.storeItemID).include(x => [x.storeItemPrices, x.storeItemTags.forEach(t => t.tag)]).toPagedList({
20234
20275
  start,
20235
20276
  size,
@@ -20244,6 +20285,12 @@ System.register(["tslib", "@web-atoms/core/dist/core/Bind", "@web-atoms/core/dis
20244
20285
  }
20245
20286
  });
20246
20287
  __decorate([InjectProperty, __metadata("design:type", EntityService)], StoreItemListView.prototype, "entityService", void 0);
20288
+ __decorate([Action({
20289
+ onEvent: "remove-tag"
20290
+ }), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0)], StoreItemListView.prototype, "removeTag", null);
20291
+ __decorate([Action({
20292
+ onEvent: "select-tag"
20293
+ }), __metadata("design:type", Function), __metadata("design:paramtypes", [Object]), __metadata("design:returntype", void 0)], StoreItemListView.prototype, "selectTag", null);
20247
20294
  }
20248
20295
  };
20249
20296
  });