@salla.sa/twilight-components 1.0.19 → 1.0.21
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/dist/{esm → twilight-components}/Helper-d07ebbc7.js +0 -0
- package/dist/twilight-components/app-globals-0f993ce5.js +3 -0
- package/dist/twilight-components/css-shim-a64b8820.js +4 -0
- package/dist/twilight-components/dom-d08ba8aa.js +73 -0
- package/dist/twilight-components/index-9c087700.js +3010 -0
- package/dist/twilight-components/index.esm.js +4 -1
- package/dist/{esm → twilight-components}/salla-branches.entry.js +1 -1
- package/dist/twilight-components/salla-button.entry.js +75 -0
- package/dist/{esm → twilight-components}/salla-localization.entry.js +1 -1
- package/dist/{esm/salla-login-38586400.js → twilight-components/salla-login-57b18c2c.js} +1 -1
- package/dist/twilight-components/salla-login.entry.js +3 -0
- package/dist/twilight-components/salla-modal.entry.js +113 -0
- package/dist/twilight-components/salla-offer.entry.js +75 -0
- package/dist/{esm → twilight-components}/salla-product-availability.entry.js +1 -1
- package/dist/twilight-components/salla-rating.entry.js +228 -0
- package/dist/{esm/salla-search-ca856aab.js → twilight-components/salla-search-30fec1e8.js} +1 -1
- package/dist/twilight-components/salla-search.entry.js +3 -0
- package/dist/{esm/salla-button_5.entry.js → twilight-components/salla-tel-input.entry.js} +33 -294
- package/dist/twilight-components/salla-verify.entry.js +114 -0
- package/dist/twilight-components/shadow-css-bc14d9fd.js +389 -0
- package/dist/twilight-components/twilight-components.css +3 -1
- package/dist/twilight-components/twilight-components.esm.js +125 -1
- package/dist/types/components/salla-offer/offer-schema.d.ts +47 -0
- package/dist/types/components/salla-offer/salla-offer.d.ts +13 -48
- package/dist/types/components/salla-rating/order-feedback-response.d.ts +62 -0
- package/dist/types/components/salla-rating/salla-rating.d.ts +25 -23
- package/dist/types/components.d.ts +2 -10
- package/package.json +1 -1
- package/dist/cjs/Helper-fcea994c.js +0 -23
- package/dist/cjs/index-4b8b3ffe.js +0 -1696
- package/dist/cjs/index.cjs.js +0 -13
- package/dist/cjs/loader.cjs.js +0 -21
- package/dist/cjs/salla-branches.cjs.entry.js +0 -92
- package/dist/cjs/salla-button_5.cjs.entry.js +0 -1686
- package/dist/cjs/salla-localization.cjs.entry.js +0 -82
- package/dist/cjs/salla-login-008cc893.js +0 -125
- package/dist/cjs/salla-offer.cjs.entry.js +0 -50
- package/dist/cjs/salla-product-availability.cjs.entry.js +0 -75
- package/dist/cjs/salla-rating.cjs.entry.js +0 -300
- package/dist/cjs/salla-search-c7aad59a.js +0 -81
- package/dist/cjs/salla-search.cjs.entry.js +0 -11
- package/dist/cjs/twilight-components.cjs.js +0 -19
- package/dist/collection/Helpers/Helper.js +0 -19
- package/dist/collection/collection-manifest.json +0 -22
- package/dist/collection/components/generate-summary.js +0 -35
- package/dist/collection/components/salla-branches/salla-branches.css +0 -12
- package/dist/collection/components/salla-branches/salla-branches.js +0 -233
- package/dist/collection/components/salla-button/salla-button.css +0 -3
- package/dist/collection/components/salla-button/salla-button.js +0 -246
- package/dist/collection/components/salla-localization/salla-localization.js +0 -208
- package/dist/collection/components/salla-login/salla-login.css +0 -3
- package/dist/collection/components/salla-login/salla-login.js +0 -378
- package/dist/collection/components/salla-modal/salla-modal.js +0 -459
- package/dist/collection/components/salla-offer/salla-offer.js +0 -81
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +0 -331
- package/dist/collection/components/salla-rating/salla-rating.css +0 -7
- package/dist/collection/components/salla-rating/salla-rating.js +0 -483
- package/dist/collection/components/salla-search/salla-search.js +0 -132
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +0 -14
- package/dist/collection/components/salla-verify/salla-verify.js +0 -273
- package/dist/collection/index.js +0 -2
- package/dist/collection/interfaces/colors.js +0 -1
- package/dist/collection/interfaces/index.js +0 -2
- package/dist/collection/interfaces/ratio.js +0 -1
- package/dist/collection/plugins/tailwind-theme/generator.js +0 -62
- package/dist/collection/plugins/tailwind-theme/index.js +0 -26
- package/dist/esm/index-092659c7.js +0 -1668
- package/dist/esm/index.js +0 -4
- package/dist/esm/loader.js +0 -17
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/salla-offer.entry.js +0 -46
- package/dist/esm/salla-rating.entry.js +0 -296
- package/dist/esm/salla-search.entry.js +0 -3
- package/dist/esm/twilight-components.js +0 -17
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/twilight-components/p-03d0ec44.entry.js +0 -1
- package/dist/twilight-components/p-13a55257.entry.js +0 -1
- package/dist/twilight-components/p-160062c6.js +0 -1
- package/dist/twilight-components/p-47f17d3b.js +0 -1
- package/dist/twilight-components/p-5307c7b5.entry.js +0 -1
- package/dist/twilight-components/p-6a1f43c6.entry.js +0 -1
- package/dist/twilight-components/p-7088e517.entry.js +0 -1
- package/dist/twilight-components/p-924e3c88.js +0 -1
- package/dist/twilight-components/p-e8965b01.js +0 -1
- package/dist/twilight-components/p-ecb1b6cc.entry.js +0 -1
- package/dist/twilight-components/p-f11b401a.entry.js +0 -1
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index-4b8b3ffe.js');
|
|
4
|
-
const Helper = require('./Helper-fcea994c.js');
|
|
5
|
-
|
|
6
|
-
const SallaSearch = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
index.registerInstance(this, hostRef);
|
|
9
|
-
var _a, _b;
|
|
10
|
-
this.results = [];
|
|
11
|
-
/**
|
|
12
|
-
* Override search placeholder.
|
|
13
|
-
*/
|
|
14
|
-
this.placeholder = salla.lang.get('blocks.header.search_placeholder');
|
|
15
|
-
/**
|
|
16
|
-
* Override no results error message.
|
|
17
|
-
*/
|
|
18
|
-
this.noResultsText = salla.lang.get('common.elements.no_options');
|
|
19
|
-
Helper.Helper.setHost(this.host);
|
|
20
|
-
this.buttonSlot = ((_a = Helper.Helper.getElement('[slot="button"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || '<i class="sicon-search"></i>';
|
|
21
|
-
this.productSlot = ((_b = Helper.Helper.getElement('[slot="product"]')) === null || _b === void 0 ? void 0 : _b.innerHTML) || this.getDefaultProductSlot();
|
|
22
|
-
}
|
|
23
|
-
onModalClose() {
|
|
24
|
-
Helper.Helper.getElement('.s-search-input').value = '';
|
|
25
|
-
this.results = [];
|
|
26
|
-
this.afterSearching();
|
|
27
|
-
}
|
|
28
|
-
getDefaultProductSlot() {
|
|
29
|
-
return '<a target="_blank" href={url} class="s-search-product-image-container">' +
|
|
30
|
-
' <img class="s-search-product-image" src="{image}" alt="{name}"/>' +
|
|
31
|
-
'</a>' +
|
|
32
|
-
'<div class="s-search-product-details">' +
|
|
33
|
-
' <div class="s-search-product-name">{name}</div> <div class="s-search-product-price">{price}</div>' +
|
|
34
|
-
'</div>';
|
|
35
|
-
}
|
|
36
|
-
//todo:: reset data when closing
|
|
37
|
-
search(e) {
|
|
38
|
-
Helper.Helper.hideElement(this.noResults);
|
|
39
|
-
if (e.target.value.length === 0) {
|
|
40
|
-
this.results = [];
|
|
41
|
-
this.afterSearching();
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (e.target.value.length <= 2) {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
//run loading spinner or stop it
|
|
48
|
-
Helper.Helper.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => true);
|
|
49
|
-
salla.search.api.search(e.target.value)
|
|
50
|
-
.then(response => this.results = response.results)
|
|
51
|
-
.catch(err => err !== 'Query Same As Previous!' ? this.results = [] : null)
|
|
52
|
-
.finally(() => this.afterSearching(/*isEmpty*/ false));
|
|
53
|
-
}
|
|
54
|
-
afterSearching(isEmpty = true) {
|
|
55
|
-
this.noResults.style.display = isEmpty || this.results.length > 0 ? 'none' : 'block';
|
|
56
|
-
Helper.Helper.toggleElement(this.container, 's-search-container-open', 'no-results', () => this.results.length)
|
|
57
|
-
.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => false); //stop searching anime
|
|
58
|
-
salla.search.api.previousQuery = ''; //avoid having error 'Query Same As Previous' after reopen modal;
|
|
59
|
-
}
|
|
60
|
-
render() {
|
|
61
|
-
var _a;
|
|
62
|
-
return (index.h(index.Host, { class: "s-search" }, index.h("button", { onClick: () => this.modal.show(), class: "s-search-button", innerHTML: this.buttonSlot }), index.h("salla-modal", { ref: modal => this.modal = modal }, index.h("div", { class: "s-search-container", slot: "body", ref: container => this.container = container }, index.h("input", { class: "s-search-input", type: "text", placeholder: this.placeholder, onInput: e => this.search(e) }), index.h("span", { class: "s-search-icon" }, index.h("i", { class: "sicon-search", ref: el => this.searchIcon = el })), index.h("div", { class: "s-search-results" }, (_a = this.results) === null || _a === void 0 ? void 0 :
|
|
63
|
-
_a.map(item => {
|
|
64
|
-
var _a;
|
|
65
|
-
return index.h("div", { class: "s-search-product", innerHTML: this.productSlot
|
|
66
|
-
.replace(/\{name\}/g, item.title)
|
|
67
|
-
.replace(/\{price\}/g, (_a = item.price) === null || _a === void 0 ? void 0 : _a.after) //todo:: get discounted price too
|
|
68
|
-
.replace(/\{url\}/g, item.url)
|
|
69
|
-
.replace(/\{image\}/g, item.thumb) });
|
|
70
|
-
}), index.h("p", { ref: el => this.noResults = el, class: "s-search-no-results" }, this.noResultsText))))));
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Run it one time after load
|
|
74
|
-
*/
|
|
75
|
-
componentDidLoad() {
|
|
76
|
-
this.afterSearching();
|
|
77
|
-
}
|
|
78
|
-
get host() { return index.getElement(this); }
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
exports.SallaSearch = SallaSearch;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const sallaSearch = require('./salla-search-c7aad59a.js');
|
|
6
|
-
require('./index-4b8b3ffe.js');
|
|
7
|
-
require('./Helper-fcea994c.js');
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
exports.salla_search = sallaSearch.SallaSearch;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const index = require('./index-4b8b3ffe.js');
|
|
4
|
-
|
|
5
|
-
/*
|
|
6
|
-
Stencil Client Patch Browser v2.8.1 | MIT Licensed | https://stenciljs.com
|
|
7
|
-
*/
|
|
8
|
-
const patchBrowser = () => {
|
|
9
|
-
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('twilight-components.cjs.js', document.baseURI).href));
|
|
10
|
-
const opts = {};
|
|
11
|
-
if (importMeta !== '') {
|
|
12
|
-
opts.resourcesUrl = new URL('.', importMeta).href;
|
|
13
|
-
}
|
|
14
|
-
return index.promiseResolve(opts);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
patchBrowser().then(options => {
|
|
18
|
-
return index.bootstrapLazy([["salla-button_5.cjs",[[0,"salla-login",{"isLoginByMail":[4,"is-login-by-mail"],"loginTypeTitle":[1,"login-type-title"],"loginText":[1,"login-text"],"smsLabel":[1,"sms-label"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"enterText":[1,"enter-text"],"bySMSText":[1,"by-s-m-s-text"],"byEmailText":[1,"by-email-text"],"backText":[1,"back-text"],"show":[64]},[[0,"verified","onVerified"],[0,"backClicked","onbackClicked"]]],[0,"salla-verify",{"withoutModal":[4,"without-modal"],"url":[1],"by":[1],"backText":[1,"back-text"],"autoReload":[4,"auto-reload"],"getCode":[64],"show":[64]}],[1,"salla-tel-input"],[4,"salla-button",{"btnStyle":[513,"btn-style"],"loading":[516],"disabled":[516],"loaderPosition":[1,"loader-position"],"wide":[4],"load":[64],"stop":[64],"disable":[64],"enable":[64]}],[4,"salla-modal",{"error":[4],"success":[4],"primary":[4],"isClosable":[1028,"is-closable"],"width":[513],"visible":[516],"isLoading":[1540,"is-loading"],"subTitleFirst":[4,"sub-title-first"],"subTitle":[1,"sub-title"],"icon":[1],"imageIcon":[1,"image-icon"],"title":[32],"show":[64],"hide":[64],"setTitle":[64],"loading":[64],"stopLoading":[64]}]]],["salla-branches.cjs",[[4,"salla-branches",{"position":[1],"displayAs":[1,"display-as"],"browseProductsFrom":[1,"browse-products-from"],"branches":[16],"current":[1026],"open":[32],"selected":[32],"isOpenedBefore":[32],"show":[64],"hide":[64]}]]],["salla-localization.cjs",[[4,"salla-localization",{"languagesTitle":[1,"languages-title"],"currenciesTitle":[1,"currencies-title"],"ok":[1],"show":[64],"hide":[64],"submit":[64]}]]],["salla-product-availability.cjs",[[4,"salla-product-availability",{"channels":[1],"buttonText":[1,"button-text"],"countryCode":[1,"country-code"],"subscribeText":[1,"subscribe-text"],"cancelText":[1,"cancel-text"],"subTitle":[1,"sub-title"],"mobileLabel":[1,"mobile-label"],"emailLabel":[1,"email-label"],"mobilePlaceholder":[1,"mobile-placeholder"],"emailPlaceholder":[1,"email-placeholder"],"productId":[2,"product-id"],"subscribedMessage":[1,"subscribed-message"],"isSubscribed":[1028,"is-subscribed"],"submit":[64]}]]],["salla-rating.cjs",[[0,"salla-rating",{"orderId":[2,"order-id"],"thanksMsg":[1,"thanks-msg"],"isStoreRating":[4,"is-store-rating"],"isProductsRating":[4,"is-products-rating"],"isShippingRating":[4,"is-shipping-rating"],"show":[64],"hide":[64]}]]],["salla-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[64]}]]],["salla-search.cjs",[[0,"salla-search",{"placeholder":[1],"noResultsText":[1,"no-results-text"],"results":[32]},[[0,"modalClosed","onModalClose"]]]]]], options);
|
|
19
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
class Helper extends salla.AppHelpers {
|
|
2
|
-
setHost(host) {
|
|
3
|
-
this.host = host;
|
|
4
|
-
}
|
|
5
|
-
getElement(selector) {
|
|
6
|
-
return this.host.querySelector(selector);
|
|
7
|
-
}
|
|
8
|
-
getAttribute(selector, attribute) {
|
|
9
|
-
var _a;
|
|
10
|
-
return (_a = this.getElement(selector)) === null || _a === void 0 ? void 0 : _a.getAttribute(attribute);
|
|
11
|
-
}
|
|
12
|
-
val(selector) {
|
|
13
|
-
return this.getAttribute(selector, 'value');
|
|
14
|
-
}
|
|
15
|
-
isUser() {
|
|
16
|
-
return salla.config.get('user.type') === 'user';
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
export default new Helper;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"entries": [
|
|
3
|
-
"./components/salla-login/salla-login.js",
|
|
4
|
-
"./components/salla-search/salla-search.js",
|
|
5
|
-
"./components/salla-branches/salla-branches.js",
|
|
6
|
-
"./components/salla-button/salla-button.js",
|
|
7
|
-
"./components/salla-localization/salla-localization.js",
|
|
8
|
-
"./components/salla-modal/salla-modal.js",
|
|
9
|
-
"./components/salla-offer/salla-offer.js",
|
|
10
|
-
"./components/salla-product-availability/salla-product-availability.js",
|
|
11
|
-
"./components/salla-rating/salla-rating.js",
|
|
12
|
-
"./components/salla-tel-input/salla-tel-input.js",
|
|
13
|
-
"./components/salla-verify/salla-verify.js"
|
|
14
|
-
],
|
|
15
|
-
"compiler": {
|
|
16
|
-
"name": "@stencil/core",
|
|
17
|
-
"version": "2.8.1",
|
|
18
|
-
"typescriptVersion": "4.2.3"
|
|
19
|
-
},
|
|
20
|
-
"collections": [],
|
|
21
|
-
"bundles": []
|
|
22
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
var fs = require('fs'), path = require('path'), util = require('util');
|
|
2
|
-
|
|
3
|
-
var dirToJSON = function (dir, done) {
|
|
4
|
-
var results = [];
|
|
5
|
-
|
|
6
|
-
function recWalk(d, res) {
|
|
7
|
-
var list = fs.readdirSync(d);
|
|
8
|
-
list.forEach((name) => {
|
|
9
|
-
var file = path.resolve(d, name);
|
|
10
|
-
var stat = fs.statSync(file);
|
|
11
|
-
if (stat && stat.isDirectory()) {
|
|
12
|
-
var title;
|
|
13
|
-
if (name) {
|
|
14
|
-
title = 'salla-' + name
|
|
15
|
-
}
|
|
16
|
-
res.push({ title: title, file: name + '/readme.md' });
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
try {
|
|
22
|
-
recWalk(dir, results);
|
|
23
|
-
done(null, results);
|
|
24
|
-
} catch (err) {
|
|
25
|
-
done(err);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
dirToJSON("src/components", function (err, results) {
|
|
30
|
-
if (err) console.log(err);
|
|
31
|
-
else fs.writeFile('src/components/summary.json', JSON.stringify(results), 'utf8', function (err) {
|
|
32
|
-
if (err) throw err;
|
|
33
|
-
console.log('Saved!');
|
|
34
|
-
});
|
|
35
|
-
});
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import { Component, h, Prop, Method, State, Element } from "@stencil/core";
|
|
2
|
-
let engine = require('store/src/store-engine');
|
|
3
|
-
let storages = require('store/storages/sessionStorage');
|
|
4
|
-
let sessionStore = engine.createStore(storages);
|
|
5
|
-
export class SallaBranches {
|
|
6
|
-
constructor() {
|
|
7
|
-
this.open = false;
|
|
8
|
-
this.isOpenedBefore = sessionStore.get("branch-choosed-before");
|
|
9
|
-
this.displayAs = 'default';
|
|
10
|
-
this.browseProductsFrom = 'all';
|
|
11
|
-
this.branches = [
|
|
12
|
-
{ id: 1, name: 'فرع الرياض', open: true, available: true, limited: false, tag: 'متوفر' },
|
|
13
|
-
{ id: 2, name: 'فرع جدة', open: false, available: false, limited: false, tag: 'غير متوفر' },
|
|
14
|
-
{ id: 3, name: 'فرع مكة', open: true, available: true, limited: false, tag: 'متوفر' },
|
|
15
|
-
{ id: 4, name: 'فرع المدينة', open: true, available: true, limited: false, tag: 'متوفر' },
|
|
16
|
-
{ id: 5, name: 'فرع جازان', open: true, available: true, limited: true, tag: 'الكمية محدودة' }
|
|
17
|
-
];
|
|
18
|
-
this.current = 1;
|
|
19
|
-
this.currentBranch = (prop) => {
|
|
20
|
-
return this.branches.filter((el) => el.id == this.current)[0][prop];
|
|
21
|
-
};
|
|
22
|
-
this.statusColor = (branch = null) => {
|
|
23
|
-
return branch ?
|
|
24
|
-
branch.limited ? 's-branches-color-red' : branch.available ? 's-branches-color-green' : 's-branches-color-gray'
|
|
25
|
-
:
|
|
26
|
-
this.currentBranch('limited') ? 's-branches-color-red' : this.currentBranch('available') ? 's-branches-color-green' : 's-branches-color-gray';
|
|
27
|
-
};
|
|
28
|
-
this.isChoiceable = () => {
|
|
29
|
-
return (this.browseProductsFrom !== 'all' && this.position == 'single') || this.position == 'header';
|
|
30
|
-
};
|
|
31
|
-
this.formTitle = () => {
|
|
32
|
-
return this.isChoiceable() ?
|
|
33
|
-
'توفر المنتج في الفروع الآخرى'
|
|
34
|
-
: 'التسوق من فرع آخر';
|
|
35
|
-
};
|
|
36
|
-
salla.event.on('branches::show', () => this.show());
|
|
37
|
-
}
|
|
38
|
-
async show() {
|
|
39
|
-
return this.modal.show();
|
|
40
|
-
}
|
|
41
|
-
async hide() {
|
|
42
|
-
return this.modal.hide();
|
|
43
|
-
}
|
|
44
|
-
handelChange(event) {
|
|
45
|
-
this.selected = event.target.value;
|
|
46
|
-
}
|
|
47
|
-
handleSubmit() {
|
|
48
|
-
this.btn.load().then(() => {
|
|
49
|
-
setTimeout(() => location.reload(), 2000);
|
|
50
|
-
});
|
|
51
|
-
sessionStore.set("branch-choosed-before", true);
|
|
52
|
-
this.show();
|
|
53
|
-
setTimeout(() => {
|
|
54
|
-
this.current = this.selected;
|
|
55
|
-
}, 300);
|
|
56
|
-
}
|
|
57
|
-
render() {
|
|
58
|
-
return (h("salla-modal", { icon: "sicon-store-alt", title: "\u0641\u0631\u0639 \u0627\u0644\u0631\u064A\u0627\u0636", "sub-title": "\u0623\u0646\u062A \u0627\u0644\u0622\u0646 \u062A\u062A\u0635\u0641\u062D \u0627\u0644\u0645\u062A\u062C\u0631 \u0645\u0646", "sub-title-first": true, "is-closable": !this.isOpenedBefore && this.displayAs == 'popup' ? 'false' : 'true', ref: modal => this.modal = modal, "modal-width": "sm", id: "s-branches-modal", class: "hidden" },
|
|
59
|
-
h("h4", { class: "s-branches-title" }, this.formTitle()),
|
|
60
|
-
this.branches.length <= 5 ?
|
|
61
|
-
h("div", { class: "s-branches-space-v" }, this.branches.map((branch) => h("div", { class: "s-branches-input-wrap" },
|
|
62
|
-
h("input", { id: this.position + '_branch_' + branch.id, disabled: !branch.open && this.isChoiceable(), name: "lang", type: "radio", value: branch.id, onChange: (event) => this.handelChange(event), class: {
|
|
63
|
-
's-branches-input': true,
|
|
64
|
-
'opacity-50': !branch.open,
|
|
65
|
-
'hidden': !this.isChoiceable()
|
|
66
|
-
}, checked: this.current == branch.id }),
|
|
67
|
-
h("label", { htmlFor: this.position + '_branch_' + branch.id, class: {
|
|
68
|
-
's-branches-label': true,
|
|
69
|
-
's-branches-clickable': this.isChoiceable()
|
|
70
|
-
} },
|
|
71
|
-
h("span", { class: { 's-branches-is-closed': !branch.open } }, branch.name),
|
|
72
|
-
this.isChoiceable() ?
|
|
73
|
-
h("small", { class: "s-branches-closed-badge" }, branch.open ? '' : 'مُغلق')
|
|
74
|
-
:
|
|
75
|
-
h("span", { class: this.statusColor(branch) }, branch.tag)))))
|
|
76
|
-
:
|
|
77
|
-
h("select", { class: "s-branches-select", onInput: (event) => this.handelChange(event) }, this.branches.map(branch => (h("option", { value: branch.id, disabled: !branch.open, selected: this.selected == branch.id },
|
|
78
|
-
branch.name,
|
|
79
|
-
" ",
|
|
80
|
-
branch.open ? '' : '- مُغلق')))),
|
|
81
|
-
this.isChoiceable() ?
|
|
82
|
-
h("slot", { name: "footer" },
|
|
83
|
-
h("salla-button", { ref: btn => this.btn = btn, onClick: () => this.handleSubmit(), class: "s-branches-submit", wide: true }, salla.lang.get('common.elements.ok')))
|
|
84
|
-
: ''));
|
|
85
|
-
}
|
|
86
|
-
componentDidRender() {
|
|
87
|
-
if (!this.isOpenedBefore && this.displayAs == 'popup') {
|
|
88
|
-
this.show();
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
static get is() { return "salla-branches"; }
|
|
92
|
-
static get originalStyleUrls() { return {
|
|
93
|
-
"$": ["salla-branches.scss"]
|
|
94
|
-
}; }
|
|
95
|
-
static get styleUrls() { return {
|
|
96
|
-
"$": ["salla-branches.css"]
|
|
97
|
-
}; }
|
|
98
|
-
static get properties() { return {
|
|
99
|
-
"position": {
|
|
100
|
-
"type": "string",
|
|
101
|
-
"mutable": false,
|
|
102
|
-
"complexType": {
|
|
103
|
-
"original": "string",
|
|
104
|
-
"resolved": "string",
|
|
105
|
-
"references": {}
|
|
106
|
-
},
|
|
107
|
-
"required": false,
|
|
108
|
-
"optional": false,
|
|
109
|
-
"docs": {
|
|
110
|
-
"tags": [],
|
|
111
|
-
"text": ""
|
|
112
|
-
},
|
|
113
|
-
"attribute": "position",
|
|
114
|
-
"reflect": false
|
|
115
|
-
},
|
|
116
|
-
"displayAs": {
|
|
117
|
-
"type": "string",
|
|
118
|
-
"mutable": false,
|
|
119
|
-
"complexType": {
|
|
120
|
-
"original": "string",
|
|
121
|
-
"resolved": "string",
|
|
122
|
-
"references": {}
|
|
123
|
-
},
|
|
124
|
-
"required": false,
|
|
125
|
-
"optional": false,
|
|
126
|
-
"docs": {
|
|
127
|
-
"tags": [],
|
|
128
|
-
"text": ""
|
|
129
|
-
},
|
|
130
|
-
"attribute": "display-as",
|
|
131
|
-
"reflect": false,
|
|
132
|
-
"defaultValue": "'default'"
|
|
133
|
-
},
|
|
134
|
-
"browseProductsFrom": {
|
|
135
|
-
"type": "string",
|
|
136
|
-
"mutable": false,
|
|
137
|
-
"complexType": {
|
|
138
|
-
"original": "string",
|
|
139
|
-
"resolved": "string",
|
|
140
|
-
"references": {}
|
|
141
|
-
},
|
|
142
|
-
"required": false,
|
|
143
|
-
"optional": false,
|
|
144
|
-
"docs": {
|
|
145
|
-
"tags": [],
|
|
146
|
-
"text": ""
|
|
147
|
-
},
|
|
148
|
-
"attribute": "browse-products-from",
|
|
149
|
-
"reflect": false,
|
|
150
|
-
"defaultValue": "'all'"
|
|
151
|
-
},
|
|
152
|
-
"branches": {
|
|
153
|
-
"type": "unknown",
|
|
154
|
-
"mutable": false,
|
|
155
|
-
"complexType": {
|
|
156
|
-
"original": "any[]",
|
|
157
|
-
"resolved": "any[]",
|
|
158
|
-
"references": {}
|
|
159
|
-
},
|
|
160
|
-
"required": false,
|
|
161
|
-
"optional": false,
|
|
162
|
-
"docs": {
|
|
163
|
-
"tags": [],
|
|
164
|
-
"text": ""
|
|
165
|
-
},
|
|
166
|
-
"defaultValue": "[\n {id: 1, name: '\u0641\u0631\u0639 \u0627\u0644\u0631\u064A\u0627\u0636', open: true, available: true, limited: false, tag: '\u0645\u062A\u0648\u0641\u0631'},\n {id: 2, name: '\u0641\u0631\u0639 \u062C\u062F\u0629', open: false, available: false, limited: false, tag: '\u063A\u064A\u0631 \u0645\u062A\u0648\u0641\u0631'},\n {id: 3, name: '\u0641\u0631\u0639 \u0645\u0643\u0629', open: true, available: true, limited: false, tag: '\u0645\u062A\u0648\u0641\u0631'},\n {id: 4, name: '\u0641\u0631\u0639 \u0627\u0644\u0645\u062F\u064A\u0646\u0629', open: true, available: true, limited: false, tag: '\u0645\u062A\u0648\u0641\u0631'},\n {id: 5, name: '\u0641\u0631\u0639 \u062C\u0627\u0632\u0627\u0646', open: true, available: true, limited: true, tag: '\u0627\u0644\u0643\u0645\u064A\u0629 \u0645\u062D\u062F\u0648\u062F\u0629'}\n ]"
|
|
167
|
-
},
|
|
168
|
-
"current": {
|
|
169
|
-
"type": "number",
|
|
170
|
-
"mutable": true,
|
|
171
|
-
"complexType": {
|
|
172
|
-
"original": "number",
|
|
173
|
-
"resolved": "number",
|
|
174
|
-
"references": {}
|
|
175
|
-
},
|
|
176
|
-
"required": false,
|
|
177
|
-
"optional": false,
|
|
178
|
-
"docs": {
|
|
179
|
-
"tags": [],
|
|
180
|
-
"text": ""
|
|
181
|
-
},
|
|
182
|
-
"attribute": "current",
|
|
183
|
-
"reflect": false,
|
|
184
|
-
"defaultValue": "1"
|
|
185
|
-
}
|
|
186
|
-
}; }
|
|
187
|
-
static get states() { return {
|
|
188
|
-
"open": {},
|
|
189
|
-
"selected": {},
|
|
190
|
-
"isOpenedBefore": {}
|
|
191
|
-
}; }
|
|
192
|
-
static get methods() { return {
|
|
193
|
-
"show": {
|
|
194
|
-
"complexType": {
|
|
195
|
-
"signature": "() => Promise<HTMLElement>",
|
|
196
|
-
"parameters": [],
|
|
197
|
-
"references": {
|
|
198
|
-
"Promise": {
|
|
199
|
-
"location": "global"
|
|
200
|
-
},
|
|
201
|
-
"HTMLElement": {
|
|
202
|
-
"location": "global"
|
|
203
|
-
}
|
|
204
|
-
},
|
|
205
|
-
"return": "Promise<HTMLElement>"
|
|
206
|
-
},
|
|
207
|
-
"docs": {
|
|
208
|
-
"text": "",
|
|
209
|
-
"tags": []
|
|
210
|
-
}
|
|
211
|
-
},
|
|
212
|
-
"hide": {
|
|
213
|
-
"complexType": {
|
|
214
|
-
"signature": "() => Promise<HTMLElement>",
|
|
215
|
-
"parameters": [],
|
|
216
|
-
"references": {
|
|
217
|
-
"Promise": {
|
|
218
|
-
"location": "global"
|
|
219
|
-
},
|
|
220
|
-
"HTMLElement": {
|
|
221
|
-
"location": "global"
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
"return": "Promise<HTMLElement>"
|
|
225
|
-
},
|
|
226
|
-
"docs": {
|
|
227
|
-
"text": "",
|
|
228
|
-
"tags": []
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}; }
|
|
232
|
-
static get elementRef() { return "host"; }
|
|
233
|
-
}
|