@salla.sa/twilight-components 1.0.21 → 1.0.22
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/cjs/Helper-fcea994c.js +23 -0
- package/dist/cjs/index-714023c8.js +1653 -0
- package/dist/cjs/index.cjs.js +13 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/salla-branches.cjs.entry.js +92 -0
- package/dist/cjs/salla-button_5.cjs.entry.js +1727 -0
- package/dist/cjs/salla-localization.cjs.entry.js +82 -0
- package/dist/cjs/salla-login-c438bb35.js +128 -0
- package/dist/cjs/salla-offer.cjs.entry.js +79 -0
- package/dist/cjs/salla-product-availability.cjs.entry.js +75 -0
- package/dist/cjs/salla-rating.cjs.entry.js +195 -0
- package/dist/cjs/salla-search-45173394.js +85 -0
- package/dist/cjs/salla-search.cjs.entry.js +11 -0
- package/dist/cjs/twilight-components.cjs.js +19 -0
- package/dist/collection/Helpers/Helper.js +19 -0
- package/dist/collection/collection-manifest.json +22 -0
- package/dist/collection/components/generate-summary.js +35 -0
- package/dist/collection/components/salla-branches/salla-branches.css +12 -0
- package/dist/collection/components/salla-branches/salla-branches.js +233 -0
- package/dist/collection/components/salla-button/salla-button.css +3 -0
- package/dist/collection/components/salla-button/salla-button.js +246 -0
- package/dist/collection/components/salla-localization/salla-localization.js +208 -0
- package/dist/collection/components/salla-login/salla-login.css +3 -0
- package/dist/collection/components/salla-login/salla-login.js +380 -0
- package/dist/collection/components/salla-modal/salla-modal.js +477 -0
- package/dist/collection/components/salla-offer/offer-schema.js +1 -0
- package/dist/collection/components/salla-offer/salla-offer.js +110 -0
- package/dist/collection/components/salla-product-availability/salla-product-availability.js +331 -0
- package/dist/collection/components/salla-rating/order-feedback-response.js +1 -0
- package/dist/collection/components/salla-rating/salla-rating.css +7 -0
- package/dist/collection/components/salla-rating/salla-rating.js +277 -0
- package/dist/collection/components/salla-search/salla-search.css +24 -0
- package/dist/collection/components/salla-search/salla-search.js +143 -0
- package/dist/collection/components/salla-tel-input/salla-tel-input.js +121 -0
- package/dist/collection/components/salla-verify/salla-verify.js +280 -0
- package/dist/collection/index.js +2 -0
- package/dist/collection/interfaces/colors.js +1 -0
- package/dist/collection/interfaces/index.js +2 -0
- package/dist/collection/interfaces/ratio.js +1 -0
- package/dist/collection/plugins/tailwind-theme/generator.js +62 -0
- package/dist/collection/plugins/tailwind-theme/index.js +26 -0
- package/dist/{twilight-components → esm}/Helper-d07ebbc7.js +0 -0
- package/dist/esm/index-a1bf769d.js +1625 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/{twilight-components → esm}/salla-branches.entry.js +2 -2
- package/dist/{twilight-components/salla-tel-input.entry.js → esm/salla-button_5.entry.js} +337 -35
- package/dist/{twilight-components → esm}/salla-localization.entry.js +1 -1
- package/dist/{twilight-components/salla-login-57b18c2c.js → esm/salla-login-dd957742.js} +26 -23
- package/dist/{twilight-components → esm}/salla-offer.entry.js +1 -1
- package/dist/{twilight-components → esm}/salla-product-availability.entry.js +1 -1
- package/dist/{twilight-components → esm}/salla-rating.entry.js +71 -108
- package/dist/{twilight-components/salla-search-30fec1e8.js → esm/salla-search-5e691ebb.js} +15 -11
- package/dist/esm/salla-search.entry.js +3 -0
- package/dist/esm/twilight-components.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/twilight-components/index.esm.js +1 -4
- package/dist/twilight-components/p-1a6d8171.entry.js +1 -0
- package/dist/twilight-components/p-1deb8111.entry.js +1 -0
- package/dist/twilight-components/p-3a4d963e.js +1 -0
- package/dist/twilight-components/p-47f17d3b.js +1 -0
- package/dist/twilight-components/p-5b2eb87d.entry.js +1 -0
- package/dist/twilight-components/p-6a5be894.js +1 -0
- package/dist/twilight-components/p-7fbdf746.entry.js +1 -0
- package/dist/twilight-components/p-7fe5d346.entry.js +1 -0
- package/dist/twilight-components/p-81a61f4e.js +1 -0
- package/dist/twilight-components/p-ce991664.entry.js +1 -0
- package/dist/twilight-components/p-da73fc9b.entry.js +1 -0
- package/dist/twilight-components/twilight-components.css +1 -3
- package/dist/twilight-components/twilight-components.esm.js +1 -125
- package/dist/types/components/salla-login/salla-login.d.ts +3 -3
- package/dist/types/components/salla-modal/salla-modal.d.ts +1 -0
- package/dist/types/components/salla-rating/salla-rating.d.ts +6 -23
- package/dist/types/components/salla-search/salla-search.d.ts +1 -1
- package/dist/types/components/salla-tel-input/salla-tel-input.d.ts +14 -0
- package/dist/types/components/salla-verify/salla-verify.d.ts +3 -1
- package/dist/types/components.d.ts +12 -35
- package/package.json +1 -1
- package/dist/twilight-components/app-globals-0f993ce5.js +0 -3
- package/dist/twilight-components/css-shim-a64b8820.js +0 -4
- package/dist/twilight-components/dom-d08ba8aa.js +0 -73
- package/dist/twilight-components/index-9c087700.js +0 -3010
- package/dist/twilight-components/salla-button.entry.js +0 -75
- package/dist/twilight-components/salla-login.entry.js +0 -3
- package/dist/twilight-components/salla-modal.entry.js +0 -113
- package/dist/twilight-components/salla-search.entry.js +0 -3
- package/dist/twilight-components/salla-verify.entry.js +0 -114
- package/dist/twilight-components/shadow-css-bc14d9fd.js +0 -389
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-714023c8.js');
|
|
4
|
+
const Helper = require('./Helper-fcea994c.js');
|
|
5
|
+
|
|
6
|
+
const sallaSearchCss = "#s-search-modal .s-modal-wrapper{align-items:flex-start;padding:0}#s-search-modal .s-modal-spacer{display:inline}#s-search-modal .s-modal-body{padding:0;max-width:90%;margin-top:3.2rem}#s-search-modal .s-modal-close{top:1rem}";
|
|
7
|
+
|
|
8
|
+
const SallaSearch = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
index.registerInstance(this, hostRef);
|
|
11
|
+
var _a;
|
|
12
|
+
this.results = [];
|
|
13
|
+
/**
|
|
14
|
+
* Override search placeholder.
|
|
15
|
+
*/
|
|
16
|
+
this.placeholder = salla.lang.get('blocks.header.search_placeholder');
|
|
17
|
+
/**
|
|
18
|
+
* Override no results error message.
|
|
19
|
+
*/
|
|
20
|
+
this.noResultsText = salla.lang.get('common.elements.no_options');
|
|
21
|
+
Helper.Helper.setHost(this.host);
|
|
22
|
+
this.productSlot = ((_a = Helper.Helper.getElement('[slot="product"]')) === null || _a === void 0 ? void 0 : _a.innerHTML) || this.getDefaultProductSlot();
|
|
23
|
+
}
|
|
24
|
+
onModalOpen() {
|
|
25
|
+
this.modal.querySelector('.s-search-input').focus();
|
|
26
|
+
}
|
|
27
|
+
onModalClose() {
|
|
28
|
+
this.modal.querySelector('.s-search-input').value = '';
|
|
29
|
+
this.results = [];
|
|
30
|
+
this.afterSearching();
|
|
31
|
+
}
|
|
32
|
+
getDefaultProductSlot() {
|
|
33
|
+
return '<div class="s-search-product-image-container">' +
|
|
34
|
+
' <img class="s-search-product-image" src="{image}" alt="{name}"/>' +
|
|
35
|
+
'</div>' +
|
|
36
|
+
'<div class="s-search-product-details">' +
|
|
37
|
+
' <div class="s-search-product-name">{name}</div> <div class="s-search-product-price">{price}</div>' +
|
|
38
|
+
'</div>';
|
|
39
|
+
}
|
|
40
|
+
//todo:: reset data when closing
|
|
41
|
+
search(e) {
|
|
42
|
+
Helper.Helper.hideElement(this.noResults);
|
|
43
|
+
if (e.target.value.length === 0) {
|
|
44
|
+
this.results = [];
|
|
45
|
+
this.afterSearching();
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (e.target.value.length <= 2) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
//run loading spinner or stop it
|
|
52
|
+
Helper.Helper.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => true);
|
|
53
|
+
salla.search.api.search(e.target.value)
|
|
54
|
+
.then(response => this.results = response.results)
|
|
55
|
+
.catch(err => err !== 'Query Same As Previous!' ? this.results = [] : null)
|
|
56
|
+
.finally(() => this.afterSearching(/*isEmpty*/ false));
|
|
57
|
+
}
|
|
58
|
+
afterSearching(isEmpty = true) {
|
|
59
|
+
this.noResults.style.display = isEmpty || this.results.length > 0 ? 'none' : 'block';
|
|
60
|
+
Helper.Helper.toggleElement(this.container, 's-search-container-open', 'no-results', () => this.results.length)
|
|
61
|
+
.toggleElement(this.searchIcon, 's-search-spinner-loader', 'sicon-search', () => false); //stop searching anime
|
|
62
|
+
salla.search.api.previousQuery = ''; //avoid having error 'Query Same As Previous' after reopen modal;
|
|
63
|
+
}
|
|
64
|
+
render() {
|
|
65
|
+
var _a;
|
|
66
|
+
return (index.h("salla-modal", { position: "top", id: "s-search-modal", ref: modal => this.modal = modal }, index.h("div", { class: "s-search-container", 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 :
|
|
67
|
+
_a.map(item => {
|
|
68
|
+
var _a;
|
|
69
|
+
return index.h("a", { href: item.url, class: "s-search-product", innerHTML: this.productSlot
|
|
70
|
+
.replace(/\{name\}/g, item.title)
|
|
71
|
+
.replace(/\{price\}/g, (_a = item.price) === null || _a === void 0 ? void 0 : _a.after) //todo:: get discounted price too
|
|
72
|
+
.replace(/\{image\}/g, item.thumb) });
|
|
73
|
+
}), index.h("p", { ref: el => this.noResults = el, class: "s-search-no-results" }, this.noResultsText)))));
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Run it one time after load
|
|
77
|
+
*/
|
|
78
|
+
componentDidLoad() {
|
|
79
|
+
this.afterSearching();
|
|
80
|
+
}
|
|
81
|
+
get host() { return index.getElement(this); }
|
|
82
|
+
};
|
|
83
|
+
SallaSearch.style = sallaSearchCss;
|
|
84
|
+
|
|
85
|
+
exports.SallaSearch = SallaSearch;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const sallaSearch = require('./salla-search-45173394.js');
|
|
6
|
+
require('./index-714023c8.js');
|
|
7
|
+
require('./Helper-fcea994c.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
exports.salla_search = sallaSearch.SallaSearch;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const index = require('./index-714023c8.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",{"isEmailAllowed":[4,"is-email-allowed"],"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]}],[0,"salla-tel-input",{"phone":[1025],"countryCode":[1025,"country-code"],"countryKey":[1025,"country-key"],"getValues":[64]}],[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],"position":[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-offer.cjs",[[0,"salla-offer",{"offer":[32],"show":[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",{"order":[32],"show":[64],"hide":[64]}]]],["salla-search.cjs",[[0,"salla-search",{"placeholder":[1],"noResultsText":[1,"no-results-text"],"results":[32]},[[0,"modalOpened","onModalOpen"],[0,"modalClosed","onModalClose"]]]]]], options);
|
|
19
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
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;
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
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
|
+
});
|
|
@@ -0,0 +1,233 @@
|
|
|
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": "xs", 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
|
+
}
|