Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@responsive-ui/action-sheet

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@responsive-ui/action-sheet - npm Package Compare versions

Comparing version 1.0.9-alpha.6 to 1.0.9-alpha.7

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

## [1.0.9-alpha.7](https://github.com/wetix/responsive-ui/compare/v1.0.9-alpha.6...v1.0.9-alpha.7) (2022-01-05)
### Bug Fixes
* typing and `ActionSheet` bug ([e161492](https://github.com/wetix/responsive-ui/commit/e1614926cc52024ae86f8ead469fd7faf0d0a150))
## [1.0.9-alpha.6](https://github.com/wetix/responsive-ui/compare/v1.0.9-alpha.5...v1.0.9-alpha.6) (2022-01-03)

@@ -8,0 +19,0 @@

309

lib/cjs/index.js

@@ -1131,4 +1131,4 @@ 'use strict';

const child_ctx = ctx.slice();
child_ctx[18] = list[i].label;
child_ctx[19] = list[i].value;
child_ctx[22] = list[i].label;
child_ctx[23] = list[i].value;

@@ -1139,7 +1139,7 @@ child_ctx[7] = list[i].disabled !== undefined

child_ctx[20] = list[i].selected !== undefined
child_ctx[24] = list[i].selected !== undefined
? list[i].selected
: false;
child_ctx[21] = object_without_properties(list[i], ["label", "value", "disabled", "selected"]);
child_ctx[25] = object_without_properties(list[i], ["label", "value", "disabled", "selected"]);
return child_ctx;

@@ -1150,7 +1150,8 @@ }

const child_ctx = ctx.slice();
child_ctx[24] = list[i];
child_ctx[28] = list[i];
child_ctx[30] = i;
return child_ctx;
}
// (87:6) {#each items as item (item.key)}
// (90:6) {#each items as item, idx (item.key)}
function create_each_block_1(key_1, ctx) {

@@ -1160,8 +1161,8 @@ let li;

let input;
let input_data_json_value;
let input_checked_value;
let t0;
let t1_value = /*item*/ ctx[24].label + "";
let t1_value = /*item*/ ctx[28].label + "";
let t1;
let t2;
let li_data_json_value;

@@ -1178,6 +1179,7 @@ return {

t2 = space();
attr(input, "name", /*tabName*/ ctx[9]);
attr(input, "data-json", input_data_json_value = JSON.stringify({ .../*item*/ ctx[28], options: undefined }));
attr(input, "name", /*tabName*/ ctx[11]);
attr(input, "type", "radio");
input.checked = input_checked_value = /*item*/ ctx[24].selected || false;
attr(li, "data-json", li_data_json_value = JSON.stringify({ .../*item*/ ctx[24], options: undefined }));
input.checked = input_checked_value = /*item*/ ctx[28].selected || false;
toggle_class(label, "resp-action-sheet__tab-item--selected", /*idx*/ ctx[30] == 0 && /*activeKey*/ ctx[0] == "" || /*activeKey*/ ctx[0] === /*item*/ ctx[28].key);
this.first = li;

@@ -1196,10 +1198,14 @@ },

if (dirty & /*items*/ 1 && input_checked_value !== (input_checked_value = /*item*/ ctx[24].selected || false)) {
if (dirty[0] & /*items*/ 2 && input_data_json_value !== (input_data_json_value = JSON.stringify({ .../*item*/ ctx[28], options: undefined }))) {
attr(input, "data-json", input_data_json_value);
}
if (dirty[0] & /*items*/ 2 && input_checked_value !== (input_checked_value = /*item*/ ctx[28].selected || false)) {
input.checked = input_checked_value;
}
if (dirty & /*items*/ 1 && t1_value !== (t1_value = /*item*/ ctx[24].label + "")) set_data(t1, t1_value);
if (dirty[0] & /*items*/ 2 && t1_value !== (t1_value = /*item*/ ctx[28].label + "")) set_data(t1, t1_value);
if (dirty & /*items*/ 1 && li_data_json_value !== (li_data_json_value = JSON.stringify({ .../*item*/ ctx[24], options: undefined }))) {
attr(li, "data-json", li_data_json_value);
if (dirty[0] & /*items, activeKey*/ 3) {
toggle_class(label, "resp-action-sheet__tab-item--selected", /*idx*/ ctx[30] == 0 && /*activeKey*/ ctx[0] == "" || /*activeKey*/ ctx[0] === /*item*/ ctx[28].key);
}

@@ -1213,3 +1219,3 @@ },

// (106:4) {#each items[selectedIndex].options || [] as { label, value, disabled = false, selected = false, ...otherProps }}
// (117:4) {#each items[selectedIndex < 0 ? 0 : selectedIndex].options || [] as { label, value, disabled = false, selected = false, ...otherProps }}
function create_each_block(ctx) {

@@ -1219,2 +1225,3 @@ let li;

let input;
let input_data_json_value;
let input_disabled_value;

@@ -1225,6 +1232,5 @@ let input_value_value;

let div;
let t1_value = /*label*/ ctx[18] + "";
let t1_value = /*label*/ ctx[22] + "";
let t1;
let t2;
let li_data_json_value;

@@ -1241,15 +1247,16 @@ return {

attr(input, "type", "checkbox");
attr(input, "data-json", input_data_json_value = JSON.stringify({
.../*otherProps*/ ctx[25],
label: /*label*/ ctx[22],
value: /*value*/ ctx[23],
selected: /*selected*/ ctx[24],
disabled: /*disabled*/ ctx[7]
}));
input.disabled = input_disabled_value = /*disabled*/ ctx[7];
input.value = input_value_value = /*value*/ ctx[19];
input.checked = input_checked_value = /*selected*/ ctx[20];
input.value = input_value_value = /*value*/ ctx[23];
input.checked = input_checked_value = /*selected*/ ctx[24];
attr(div, "class", "resp-action-sheet__option-label");
attr(li, "class", "resp-action-sheet__option");
attr(li, "data-json", li_data_json_value = JSON.stringify({
.../*otherProps*/ ctx[21],
label: /*label*/ ctx[18],
value: /*value*/ ctx[19],
selected: /*selected*/ ctx[20],
disabled: /*disabled*/ ctx[7]
}));
},

@@ -1266,25 +1273,25 @@ m(target, anchor) {

p(ctx, dirty) {
if (dirty & /*items, selectedIndex*/ 9 && input_disabled_value !== (input_disabled_value = /*disabled*/ ctx[7])) {
if (dirty[0] & /*items, selectedIndex*/ 258 && input_data_json_value !== (input_data_json_value = JSON.stringify({
.../*otherProps*/ ctx[25],
label: /*label*/ ctx[22],
value: /*value*/ ctx[23],
selected: /*selected*/ ctx[24],
disabled: /*disabled*/ ctx[7]
}))) {
attr(input, "data-json", input_data_json_value);
}
if (dirty[0] & /*items, selectedIndex*/ 258 && input_disabled_value !== (input_disabled_value = /*disabled*/ ctx[7])) {
input.disabled = input_disabled_value;
}
if (dirty & /*items, selectedIndex*/ 9 && input_value_value !== (input_value_value = /*value*/ ctx[19])) {
if (dirty[0] & /*items, selectedIndex*/ 258 && input_value_value !== (input_value_value = /*value*/ ctx[23])) {
input.value = input_value_value;
}
if (dirty & /*items, selectedIndex*/ 9 && input_checked_value !== (input_checked_value = /*selected*/ ctx[20])) {
if (dirty[0] & /*items, selectedIndex*/ 258 && input_checked_value !== (input_checked_value = /*selected*/ ctx[24])) {
input.checked = input_checked_value;
}
if (dirty & /*items, selectedIndex*/ 9 && t1_value !== (t1_value = /*label*/ ctx[18] + "")) set_data(t1, t1_value);
if (dirty & /*items, selectedIndex*/ 9 && li_data_json_value !== (li_data_json_value = JSON.stringify({
.../*otherProps*/ ctx[21],
label: /*label*/ ctx[18],
value: /*value*/ ctx[19],
selected: /*selected*/ ctx[20],
disabled: /*disabled*/ ctx[7]
}))) {
attr(li, "data-json", li_data_json_value);
}
if (dirty[0] & /*items, selectedIndex*/ 258 && t1_value !== (t1_value = /*label*/ ctx[22] + "")) set_data(t1, t1_value);
},

@@ -1297,3 +1304,3 @@ d(detaching) {

// (125:4) <Button variant="primary" {disabled} on:click={handleOk}>
// (139:4) <Button variant="primary" {disabled} on:click={handleOk}>
function create_default_slot_1(ctx) {

@@ -1315,3 +1322,3 @@ let t;

// (74:0) <BottomSheet bind:open bind:height={modalHeight} class={className} {maskClosable} {closable} >
// (73:0) <BottomSheet bind:open bind:height={modalHeight} class={className} {maskClosable} {closable} >
function create_default_slot(ctx) {

@@ -1336,4 +1343,4 @@ let header;

let dispose;
let each_value_1 = /*items*/ ctx[0];
const get_key = ctx => /*item*/ ctx[24].key;
let each_value_1 = /*items*/ ctx[1];
const get_key = ctx => /*item*/ ctx[28].key;

@@ -1346,3 +1353,6 @@ for (let i = 0; i < each_value_1.length; i += 1) {

let each_value = /*items*/ ctx[0][/*selectedIndex*/ ctx[3]].options || [];
let each_value = /*items*/ ctx[1][/*selectedIndex*/ ctx[8] < 0
? 0
: /*selectedIndex*/ ctx[8]].options || [];
let each_blocks = [];

@@ -1363,3 +1373,3 @@

button.$on("click", /*handleOk*/ ctx[13]);
button.$on("click", /*handleOk*/ ctx[15]);

@@ -1397,3 +1407,3 @@ return {

attr(ul1, "class", "resp-action-sheet__body");
set_style(ul1, "height", /*modalHeight*/ ctx[8] - 200 + "px");
set_style(ul1, "height", /*modalHeight*/ ctx[9] - 180 + "px");
attr(footer, "class", "resp-action-sheet__footer");

@@ -1415,2 +1425,3 @@ },

/*ul0_binding*/ ctx[17](ul0);
insert(target, t4, anchor);

@@ -1430,5 +1441,5 @@ insert(target, ul1, anchor);

dispose = [
listen(span, "click", /*handleReset*/ ctx[12]),
listen(ul0, "change", /*handleTabChange*/ ctx[11]),
listen(ul1, "change", /*handleSelectOption*/ ctx[10])
listen(span, "click", /*handleReset*/ ctx[14]),
listen(ul0, "change", /*handleTabChange*/ ctx[12]),
listen(ul1, "change", /*handleSelectOption*/ ctx[13])
];

@@ -1440,11 +1451,14 @@

p(ctx, dirty) {
if (!current || dirty & /*caption*/ 16) set_data(t0, /*caption*/ ctx[4]);
if (!current || dirty[0] & /*caption*/ 16) set_data(t0, /*caption*/ ctx[4]);
if (dirty & /*JSON, items, undefined, tabName*/ 513) {
each_value_1 = /*items*/ ctx[0];
if (dirty[0] & /*items, activeKey, tabName*/ 2051) {
each_value_1 = /*items*/ ctx[1];
each_blocks_1 = update_keyed_each(each_blocks_1, dirty, get_key, 1, ctx, each_value_1, each0_lookup, ul0, destroy_block, create_each_block_1, null, get_each_context_1);
}
if (dirty & /*JSON, items, selectedIndex*/ 9) {
each_value = /*items*/ ctx[0][/*selectedIndex*/ ctx[3]].options || [];
if (dirty[0] & /*items, selectedIndex*/ 258) {
each_value = /*items*/ ctx[1][/*selectedIndex*/ ctx[8] < 0
? 0
: /*selectedIndex*/ ctx[8]].options || [];
let i;

@@ -1471,10 +1485,10 @@

if (!current || dirty & /*modalHeight*/ 256) {
set_style(ul1, "height", /*modalHeight*/ ctx[8] - 200 + "px");
if (!current || dirty[0] & /*modalHeight*/ 512) {
set_style(ul1, "height", /*modalHeight*/ ctx[9] - 180 + "px");
}
const button_changes = {};
if (dirty & /*disabled*/ 128) button_changes.disabled = /*disabled*/ ctx[7];
if (dirty[0] & /*disabled*/ 128) button_changes.disabled = /*disabled*/ ctx[7];
if (dirty & /*$$scope*/ 134217728) {
if (dirty[1] & /*$$scope*/ 1) {
button_changes.$$scope = { dirty, ctx };

@@ -1501,2 +1515,3 @@ }

/*ul0_binding*/ ctx[17](null);
if (detaching) detach(t4);

@@ -1521,11 +1536,11 @@ if (detaching) detach(ul1);

function bottomsheet_open_binding(value) {
/*bottomsheet_open_binding*/ ctx[14](value);
/*bottomsheet_open_binding*/ ctx[18](value);
}
function bottomsheet_height_binding(value) {
/*bottomsheet_height_binding*/ ctx[15](value);
/*bottomsheet_height_binding*/ ctx[19](value);
}
let bottomsheet_props = {
class: /*className*/ ctx[2],
class: /*className*/ ctx[3],
maskClosable: /*maskClosable*/ ctx[5],

@@ -1537,8 +1552,8 @@ closable: /*closable*/ ctx[6],

if (/*open*/ ctx[1] !== void 0) {
bottomsheet_props.open = /*open*/ ctx[1];
if (/*open*/ ctx[2] !== void 0) {
bottomsheet_props.open = /*open*/ ctx[2];
}
if (/*modalHeight*/ ctx[8] !== void 0) {
bottomsheet_props.height = /*modalHeight*/ ctx[8];
if (/*modalHeight*/ ctx[9] !== void 0) {
bottomsheet_props.height = /*modalHeight*/ ctx[9];
}

@@ -1558,21 +1573,21 @@

},
p(ctx, [dirty]) {
p(ctx, dirty) {
const bottomsheet_changes = {};
if (dirty & /*className*/ 4) bottomsheet_changes.class = /*className*/ ctx[2];
if (dirty & /*maskClosable*/ 32) bottomsheet_changes.maskClosable = /*maskClosable*/ ctx[5];
if (dirty & /*closable*/ 64) bottomsheet_changes.closable = /*closable*/ ctx[6];
if (dirty[0] & /*className*/ 8) bottomsheet_changes.class = /*className*/ ctx[3];
if (dirty[0] & /*maskClosable*/ 32) bottomsheet_changes.maskClosable = /*maskClosable*/ ctx[5];
if (dirty[0] & /*closable*/ 64) bottomsheet_changes.closable = /*closable*/ ctx[6];
if (dirty & /*$$scope, disabled, modalHeight, items, selectedIndex, caption*/ 134218137) {
if (dirty[0] & /*disabled, modalHeight, items, selectedIndex, tab, activeKey, caption*/ 1939 | dirty[1] & /*$$scope*/ 1) {
bottomsheet_changes.$$scope = { dirty, ctx };
}
if (!updating_open && dirty & /*open*/ 2) {
if (!updating_open && dirty[0] & /*open*/ 4) {
updating_open = true;
bottomsheet_changes.open = /*open*/ ctx[1];
bottomsheet_changes.open = /*open*/ ctx[2];
add_flush_callback(() => updating_open = false);
}
if (!updating_height && dirty & /*modalHeight*/ 256) {
if (!updating_height && dirty[0] & /*modalHeight*/ 512) {
updating_height = true;
bottomsheet_changes.height = /*modalHeight*/ ctx[8];
bottomsheet_changes.height = /*modalHeight*/ ctx[9];
add_flush_callback(() => updating_height = false);

@@ -1601,10 +1616,23 @@ }

let { class: className = "" } = $$props;
let { selected: selectedIndex = 0 } = $$props;
let selectedIndex = 0;
let modalHeight = 0;
let { activeKey = "" } = $$props;
let { caption = "" } = $$props;
let { items = [] } = $$props;
let { open = false } = $$props;
let { caption = "" } = $$props;
let { disabled = false } = $$props;
let { maskClosable = true } = $$props;
let { closable = true } = $$props;
const reset = () => {
$$invalidate(1, items = items.map(item => {
if (item.options) {
item.options = item.options.map(v => Object.assign(Object.assign({}, v), { selected: false }));
}
return item;
}));
};
let tab;
const tabName = `as_${Math.floor(Math.random() * Date.now())}`;

@@ -1616,49 +1644,31 @@

const handleSelectOption = e => {
const handleTabChange = e => {
const el = findElement(e);
if (!el) return;
const item = JSON.parse(el.dataset.json);
const { value, selected } = item;
const { options = [] } = items[selectedIndex];
const idx = options.findIndex(v => v.value === value);
if (idx < 1) return;
if (selected) {
options[idx].selected = false;
} else {
options[idx].selected = true;
}
$$invalidate(0, items[selectedIndex].options = options, items);
$$invalidate(0, items = [...items]);
dispatch("valuechange", { option: options[idx] });
const { key } = item;
const idx = items.findIndex(v => v.key === key);
if (idx < 0) return;
const { x } = el.parentNode.getBoundingClientRect();
tab && tab.scrollTo(x - 15, 0);
$$invalidate(0, activeKey = key);
dispatch("tabchange", { activeKey, item });
};
const handleTabChange = e => {
const handleSelectOption = e => {
const el = findElement(e);
if (!el) return;
const item = JSON.parse(el.dataset.json);
const { key } = item;
const idx = items.findIndex(v => v.key === key);
if (idx < 1) return;
if (el.checked) {
$$invalidate(0, items[idx].selected = true, items);
} else {
$$invalidate(0, items[idx].selected = false, items);
}
$$invalidate(0, items = [...items]);
dispatch("tabchange", { key, item });
const { value } = item;
const { options = [] } = items[selectedIndex];
const idx = options.findIndex(v => v.value === value);
if (idx < 0) return;
options[idx].selected = el.checked;
$$invalidate(1, items[selectedIndex].options = options, items);
$$invalidate(1, items = [...items]);
dispatch("valuechange", { activeKey, option: options[idx] });
};
const handleReset = () => {
$$invalidate(0, items = items.map(item => {
if (item.options) {
item.options = item.options.map(v => Object.assign(Object.assign({}, v), { selected: false }));
}
return item;
}));
reset();
dispatch("reset", {});

@@ -1668,8 +1678,15 @@ };

const handleOk = () => {
dispatch("ok", {});
dispatch("ok", { activeKey, values: [] });
};
function ul0_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
tab = $$value;
$$invalidate(10, tab);
});
}
function bottomsheet_open_binding(value) {
open = value;
$$invalidate(1, open);
$$invalidate(2, open);
}

@@ -1679,11 +1696,11 @@

modalHeight = value;
$$invalidate(8, modalHeight);
$$invalidate(9, modalHeight);
}
$$self.$$set = $$props => {
if ('class' in $$props) $$invalidate(2, className = $$props.class);
if ('selected' in $$props) $$invalidate(3, selectedIndex = $$props.selected);
if ('items' in $$props) $$invalidate(0, items = $$props.items);
if ('open' in $$props) $$invalidate(1, open = $$props.open);
if ('class' in $$props) $$invalidate(3, className = $$props.class);
if ('activeKey' in $$props) $$invalidate(0, activeKey = $$props.activeKey);
if ('caption' in $$props) $$invalidate(4, caption = $$props.caption);
if ('items' in $$props) $$invalidate(1, items = $$props.items);
if ('open' in $$props) $$invalidate(2, open = $$props.open);
if ('disabled' in $$props) $$invalidate(7, disabled = $$props.disabled);

@@ -1694,7 +1711,13 @@ if ('maskClosable' in $$props) $$invalidate(5, maskClosable = $$props.maskClosable);

$$self.$$.update = () => {
if ($$self.$$.dirty[0] & /*items, activeKey*/ 3) {
$$invalidate(8, selectedIndex = items.findIndex(v => v.key === activeKey));
}
};
return [
activeKey,
items,
open,
className,
selectedIndex,
caption,

@@ -1704,8 +1727,12 @@ maskClosable,

disabled,
selectedIndex,
modalHeight,
tab,
tabName,
handleTabChange,
handleSelectOption,
handleTabChange,
handleReset,
handleOk,
reset,
ul0_binding,
bottomsheet_open_binding,

@@ -1720,15 +1747,29 @@ bottomsheet_height_binding

init(this, options, instance, create_fragment, safe_not_equal, {
class: 2,
selected: 3,
items: 0,
open: 1,
caption: 4,
disabled: 7,
maskClosable: 5,
closable: 6
});
init(
this,
options,
instance,
create_fragment,
safe_not_equal,
{
class: 3,
activeKey: 0,
caption: 4,
items: 1,
open: 2,
disabled: 7,
maskClosable: 5,
closable: 6,
reset: 16
},
null,
[-1, -1]
);
}
get reset() {
return this.$$.ctx[16];
}
}
module.exports = ActionSheet;

@@ -1129,4 +1129,4 @@ function noop() { }

const child_ctx = ctx.slice();
child_ctx[18] = list[i].label;
child_ctx[19] = list[i].value;
child_ctx[22] = list[i].label;
child_ctx[23] = list[i].value;

@@ -1137,7 +1137,7 @@ child_ctx[7] = list[i].disabled !== undefined

child_ctx[20] = list[i].selected !== undefined
child_ctx[24] = list[i].selected !== undefined
? list[i].selected
: false;
child_ctx[21] = object_without_properties(list[i], ["label", "value", "disabled", "selected"]);
child_ctx[25] = object_without_properties(list[i], ["label", "value", "disabled", "selected"]);
return child_ctx;

@@ -1148,7 +1148,8 @@ }

const child_ctx = ctx.slice();
child_ctx[24] = list[i];
child_ctx[28] = list[i];
child_ctx[30] = i;
return child_ctx;
}
// (87:6) {#each items as item (item.key)}
// (90:6) {#each items as item, idx (item.key)}
function create_each_block_1(key_1, ctx) {

@@ -1158,8 +1159,8 @@ let li;

let input;
let input_data_json_value;
let input_checked_value;
let t0;
let t1_value = /*item*/ ctx[24].label + "";
let t1_value = /*item*/ ctx[28].label + "";
let t1;
let t2;
let li_data_json_value;

@@ -1176,6 +1177,7 @@ return {

t2 = space();
attr(input, "name", /*tabName*/ ctx[9]);
attr(input, "data-json", input_data_json_value = JSON.stringify({ .../*item*/ ctx[28], options: undefined }));
attr(input, "name", /*tabName*/ ctx[11]);
attr(input, "type", "radio");
input.checked = input_checked_value = /*item*/ ctx[24].selected || false;
attr(li, "data-json", li_data_json_value = JSON.stringify({ .../*item*/ ctx[24], options: undefined }));
input.checked = input_checked_value = /*item*/ ctx[28].selected || false;
toggle_class(label, "resp-action-sheet__tab-item--selected", /*idx*/ ctx[30] == 0 && /*activeKey*/ ctx[0] == "" || /*activeKey*/ ctx[0] === /*item*/ ctx[28].key);
this.first = li;

@@ -1194,10 +1196,14 @@ },

if (dirty & /*items*/ 1 && input_checked_value !== (input_checked_value = /*item*/ ctx[24].selected || false)) {
if (dirty[0] & /*items*/ 2 && input_data_json_value !== (input_data_json_value = JSON.stringify({ .../*item*/ ctx[28], options: undefined }))) {
attr(input, "data-json", input_data_json_value);
}
if (dirty[0] & /*items*/ 2 && input_checked_value !== (input_checked_value = /*item*/ ctx[28].selected || false)) {
input.checked = input_checked_value;
}
if (dirty & /*items*/ 1 && t1_value !== (t1_value = /*item*/ ctx[24].label + "")) set_data(t1, t1_value);
if (dirty[0] & /*items*/ 2 && t1_value !== (t1_value = /*item*/ ctx[28].label + "")) set_data(t1, t1_value);
if (dirty & /*items*/ 1 && li_data_json_value !== (li_data_json_value = JSON.stringify({ .../*item*/ ctx[24], options: undefined }))) {
attr(li, "data-json", li_data_json_value);
if (dirty[0] & /*items, activeKey*/ 3) {
toggle_class(label, "resp-action-sheet__tab-item--selected", /*idx*/ ctx[30] == 0 && /*activeKey*/ ctx[0] == "" || /*activeKey*/ ctx[0] === /*item*/ ctx[28].key);
}

@@ -1211,3 +1217,3 @@ },

// (106:4) {#each items[selectedIndex].options || [] as { label, value, disabled = false, selected = false, ...otherProps }}
// (117:4) {#each items[selectedIndex < 0 ? 0 : selectedIndex].options || [] as { label, value, disabled = false, selected = false, ...otherProps }}
function create_each_block(ctx) {

@@ -1217,2 +1223,3 @@ let li;

let input;
let input_data_json_value;
let input_disabled_value;

@@ -1223,6 +1230,5 @@ let input_value_value;

let div;
let t1_value = /*label*/ ctx[18] + "";
let t1_value = /*label*/ ctx[22] + "";
let t1;
let t2;
let li_data_json_value;

@@ -1239,15 +1245,16 @@ return {

attr(input, "type", "checkbox");
attr(input, "data-json", input_data_json_value = JSON.stringify({
.../*otherProps*/ ctx[25],
label: /*label*/ ctx[22],
value: /*value*/ ctx[23],
selected: /*selected*/ ctx[24],
disabled: /*disabled*/ ctx[7]
}));
input.disabled = input_disabled_value = /*disabled*/ ctx[7];
input.value = input_value_value = /*value*/ ctx[19];
input.checked = input_checked_value = /*selected*/ ctx[20];
input.value = input_value_value = /*value*/ ctx[23];
input.checked = input_checked_value = /*selected*/ ctx[24];
attr(div, "class", "resp-action-sheet__option-label");
attr(li, "class", "resp-action-sheet__option");
attr(li, "data-json", li_data_json_value = JSON.stringify({
.../*otherProps*/ ctx[21],
label: /*label*/ ctx[18],
value: /*value*/ ctx[19],
selected: /*selected*/ ctx[20],
disabled: /*disabled*/ ctx[7]
}));
},

@@ -1264,25 +1271,25 @@ m(target, anchor) {

p(ctx, dirty) {
if (dirty & /*items, selectedIndex*/ 9 && input_disabled_value !== (input_disabled_value = /*disabled*/ ctx[7])) {
if (dirty[0] & /*items, selectedIndex*/ 258 && input_data_json_value !== (input_data_json_value = JSON.stringify({
.../*otherProps*/ ctx[25],
label: /*label*/ ctx[22],
value: /*value*/ ctx[23],
selected: /*selected*/ ctx[24],
disabled: /*disabled*/ ctx[7]
}))) {
attr(input, "data-json", input_data_json_value);
}
if (dirty[0] & /*items, selectedIndex*/ 258 && input_disabled_value !== (input_disabled_value = /*disabled*/ ctx[7])) {
input.disabled = input_disabled_value;
}
if (dirty & /*items, selectedIndex*/ 9 && input_value_value !== (input_value_value = /*value*/ ctx[19])) {
if (dirty[0] & /*items, selectedIndex*/ 258 && input_value_value !== (input_value_value = /*value*/ ctx[23])) {
input.value = input_value_value;
}
if (dirty & /*items, selectedIndex*/ 9 && input_checked_value !== (input_checked_value = /*selected*/ ctx[20])) {
if (dirty[0] & /*items, selectedIndex*/ 258 && input_checked_value !== (input_checked_value = /*selected*/ ctx[24])) {
input.checked = input_checked_value;
}
if (dirty & /*items, selectedIndex*/ 9 && t1_value !== (t1_value = /*label*/ ctx[18] + "")) set_data(t1, t1_value);
if (dirty & /*items, selectedIndex*/ 9 && li_data_json_value !== (li_data_json_value = JSON.stringify({
.../*otherProps*/ ctx[21],
label: /*label*/ ctx[18],
value: /*value*/ ctx[19],
selected: /*selected*/ ctx[20],
disabled: /*disabled*/ ctx[7]
}))) {
attr(li, "data-json", li_data_json_value);
}
if (dirty[0] & /*items, selectedIndex*/ 258 && t1_value !== (t1_value = /*label*/ ctx[22] + "")) set_data(t1, t1_value);
},

@@ -1295,3 +1302,3 @@ d(detaching) {

// (125:4) <Button variant="primary" {disabled} on:click={handleOk}>
// (139:4) <Button variant="primary" {disabled} on:click={handleOk}>
function create_default_slot_1(ctx) {

@@ -1313,3 +1320,3 @@ let t;

// (74:0) <BottomSheet bind:open bind:height={modalHeight} class={className} {maskClosable} {closable} >
// (73:0) <BottomSheet bind:open bind:height={modalHeight} class={className} {maskClosable} {closable} >
function create_default_slot(ctx) {

@@ -1334,4 +1341,4 @@ let header;

let dispose;
let each_value_1 = /*items*/ ctx[0];
const get_key = ctx => /*item*/ ctx[24].key;
let each_value_1 = /*items*/ ctx[1];
const get_key = ctx => /*item*/ ctx[28].key;

@@ -1344,3 +1351,6 @@ for (let i = 0; i < each_value_1.length; i += 1) {

let each_value = /*items*/ ctx[0][/*selectedIndex*/ ctx[3]].options || [];
let each_value = /*items*/ ctx[1][/*selectedIndex*/ ctx[8] < 0
? 0
: /*selectedIndex*/ ctx[8]].options || [];
let each_blocks = [];

@@ -1361,3 +1371,3 @@

button.$on("click", /*handleOk*/ ctx[13]);
button.$on("click", /*handleOk*/ ctx[15]);

@@ -1395,3 +1405,3 @@ return {

attr(ul1, "class", "resp-action-sheet__body");
set_style(ul1, "height", /*modalHeight*/ ctx[8] - 200 + "px");
set_style(ul1, "height", /*modalHeight*/ ctx[9] - 180 + "px");
attr(footer, "class", "resp-action-sheet__footer");

@@ -1413,2 +1423,3 @@ },

/*ul0_binding*/ ctx[17](ul0);
insert(target, t4, anchor);

@@ -1428,5 +1439,5 @@ insert(target, ul1, anchor);

dispose = [
listen(span, "click", /*handleReset*/ ctx[12]),
listen(ul0, "change", /*handleTabChange*/ ctx[11]),
listen(ul1, "change", /*handleSelectOption*/ ctx[10])
listen(span, "click", /*handleReset*/ ctx[14]),
listen(ul0, "change", /*handleTabChange*/ ctx[12]),
listen(ul1, "change", /*handleSelectOption*/ ctx[13])
];

@@ -1438,11 +1449,14 @@

p(ctx, dirty) {
if (!current || dirty & /*caption*/ 16) set_data(t0, /*caption*/ ctx[4]);
if (!current || dirty[0] & /*caption*/ 16) set_data(t0, /*caption*/ ctx[4]);
if (dirty & /*JSON, items, undefined, tabName*/ 513) {
each_value_1 = /*items*/ ctx[0];
if (dirty[0] & /*items, activeKey, tabName*/ 2051) {
each_value_1 = /*items*/ ctx[1];
each_blocks_1 = update_keyed_each(each_blocks_1, dirty, get_key, 1, ctx, each_value_1, each0_lookup, ul0, destroy_block, create_each_block_1, null, get_each_context_1);
}
if (dirty & /*JSON, items, selectedIndex*/ 9) {
each_value = /*items*/ ctx[0][/*selectedIndex*/ ctx[3]].options || [];
if (dirty[0] & /*items, selectedIndex*/ 258) {
each_value = /*items*/ ctx[1][/*selectedIndex*/ ctx[8] < 0
? 0
: /*selectedIndex*/ ctx[8]].options || [];
let i;

@@ -1469,10 +1483,10 @@

if (!current || dirty & /*modalHeight*/ 256) {
set_style(ul1, "height", /*modalHeight*/ ctx[8] - 200 + "px");
if (!current || dirty[0] & /*modalHeight*/ 512) {
set_style(ul1, "height", /*modalHeight*/ ctx[9] - 180 + "px");
}
const button_changes = {};
if (dirty & /*disabled*/ 128) button_changes.disabled = /*disabled*/ ctx[7];
if (dirty[0] & /*disabled*/ 128) button_changes.disabled = /*disabled*/ ctx[7];
if (dirty & /*$$scope*/ 134217728) {
if (dirty[1] & /*$$scope*/ 1) {
button_changes.$$scope = { dirty, ctx };

@@ -1499,2 +1513,3 @@ }

/*ul0_binding*/ ctx[17](null);
if (detaching) detach(t4);

@@ -1519,11 +1534,11 @@ if (detaching) detach(ul1);

function bottomsheet_open_binding(value) {
/*bottomsheet_open_binding*/ ctx[14](value);
/*bottomsheet_open_binding*/ ctx[18](value);
}
function bottomsheet_height_binding(value) {
/*bottomsheet_height_binding*/ ctx[15](value);
/*bottomsheet_height_binding*/ ctx[19](value);
}
let bottomsheet_props = {
class: /*className*/ ctx[2],
class: /*className*/ ctx[3],
maskClosable: /*maskClosable*/ ctx[5],

@@ -1535,8 +1550,8 @@ closable: /*closable*/ ctx[6],

if (/*open*/ ctx[1] !== void 0) {
bottomsheet_props.open = /*open*/ ctx[1];
if (/*open*/ ctx[2] !== void 0) {
bottomsheet_props.open = /*open*/ ctx[2];
}
if (/*modalHeight*/ ctx[8] !== void 0) {
bottomsheet_props.height = /*modalHeight*/ ctx[8];
if (/*modalHeight*/ ctx[9] !== void 0) {
bottomsheet_props.height = /*modalHeight*/ ctx[9];
}

@@ -1556,21 +1571,21 @@

},
p(ctx, [dirty]) {
p(ctx, dirty) {
const bottomsheet_changes = {};
if (dirty & /*className*/ 4) bottomsheet_changes.class = /*className*/ ctx[2];
if (dirty & /*maskClosable*/ 32) bottomsheet_changes.maskClosable = /*maskClosable*/ ctx[5];
if (dirty & /*closable*/ 64) bottomsheet_changes.closable = /*closable*/ ctx[6];
if (dirty[0] & /*className*/ 8) bottomsheet_changes.class = /*className*/ ctx[3];
if (dirty[0] & /*maskClosable*/ 32) bottomsheet_changes.maskClosable = /*maskClosable*/ ctx[5];
if (dirty[0] & /*closable*/ 64) bottomsheet_changes.closable = /*closable*/ ctx[6];
if (dirty & /*$$scope, disabled, modalHeight, items, selectedIndex, caption*/ 134218137) {
if (dirty[0] & /*disabled, modalHeight, items, selectedIndex, tab, activeKey, caption*/ 1939 | dirty[1] & /*$$scope*/ 1) {
bottomsheet_changes.$$scope = { dirty, ctx };
}
if (!updating_open && dirty & /*open*/ 2) {
if (!updating_open && dirty[0] & /*open*/ 4) {
updating_open = true;
bottomsheet_changes.open = /*open*/ ctx[1];
bottomsheet_changes.open = /*open*/ ctx[2];
add_flush_callback(() => updating_open = false);
}
if (!updating_height && dirty & /*modalHeight*/ 256) {
if (!updating_height && dirty[0] & /*modalHeight*/ 512) {
updating_height = true;
bottomsheet_changes.height = /*modalHeight*/ ctx[8];
bottomsheet_changes.height = /*modalHeight*/ ctx[9];
add_flush_callback(() => updating_height = false);

@@ -1599,10 +1614,23 @@ }

let { class: className = "" } = $$props;
let { selected: selectedIndex = 0 } = $$props;
let selectedIndex = 0;
let modalHeight = 0;
let { activeKey = "" } = $$props;
let { caption = "" } = $$props;
let { items = [] } = $$props;
let { open = false } = $$props;
let { caption = "" } = $$props;
let { disabled = false } = $$props;
let { maskClosable = true } = $$props;
let { closable = true } = $$props;
const reset = () => {
$$invalidate(1, items = items.map(item => {
if (item.options) {
item.options = item.options.map(v => Object.assign(Object.assign({}, v), { selected: false }));
}
return item;
}));
};
let tab;
const tabName = `as_${Math.floor(Math.random() * Date.now())}`;

@@ -1614,49 +1642,31 @@

const handleSelectOption = e => {
const handleTabChange = e => {
const el = findElement(e);
if (!el) return;
const item = JSON.parse(el.dataset.json);
const { value, selected } = item;
const { options = [] } = items[selectedIndex];
const idx = options.findIndex(v => v.value === value);
if (idx < 1) return;
if (selected) {
options[idx].selected = false;
} else {
options[idx].selected = true;
}
$$invalidate(0, items[selectedIndex].options = options, items);
$$invalidate(0, items = [...items]);
dispatch("valuechange", { option: options[idx] });
const { key } = item;
const idx = items.findIndex(v => v.key === key);
if (idx < 0) return;
const { x } = el.parentNode.getBoundingClientRect();
tab && tab.scrollTo(x - 15, 0);
$$invalidate(0, activeKey = key);
dispatch("tabchange", { activeKey, item });
};
const handleTabChange = e => {
const handleSelectOption = e => {
const el = findElement(e);
if (!el) return;
const item = JSON.parse(el.dataset.json);
const { key } = item;
const idx = items.findIndex(v => v.key === key);
if (idx < 1) return;
if (el.checked) {
$$invalidate(0, items[idx].selected = true, items);
} else {
$$invalidate(0, items[idx].selected = false, items);
}
$$invalidate(0, items = [...items]);
dispatch("tabchange", { key, item });
const { value } = item;
const { options = [] } = items[selectedIndex];
const idx = options.findIndex(v => v.value === value);
if (idx < 0) return;
options[idx].selected = el.checked;
$$invalidate(1, items[selectedIndex].options = options, items);
$$invalidate(1, items = [...items]);
dispatch("valuechange", { activeKey, option: options[idx] });
};
const handleReset = () => {
$$invalidate(0, items = items.map(item => {
if (item.options) {
item.options = item.options.map(v => Object.assign(Object.assign({}, v), { selected: false }));
}
return item;
}));
reset();
dispatch("reset", {});

@@ -1666,8 +1676,15 @@ };

const handleOk = () => {
dispatch("ok", {});
dispatch("ok", { activeKey, values: [] });
};
function ul0_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
tab = $$value;
$$invalidate(10, tab);
});
}
function bottomsheet_open_binding(value) {
open = value;
$$invalidate(1, open);
$$invalidate(2, open);
}

@@ -1677,11 +1694,11 @@

modalHeight = value;
$$invalidate(8, modalHeight);
$$invalidate(9, modalHeight);
}
$$self.$$set = $$props => {
if ('class' in $$props) $$invalidate(2, className = $$props.class);
if ('selected' in $$props) $$invalidate(3, selectedIndex = $$props.selected);
if ('items' in $$props) $$invalidate(0, items = $$props.items);
if ('open' in $$props) $$invalidate(1, open = $$props.open);
if ('class' in $$props) $$invalidate(3, className = $$props.class);
if ('activeKey' in $$props) $$invalidate(0, activeKey = $$props.activeKey);
if ('caption' in $$props) $$invalidate(4, caption = $$props.caption);
if ('items' in $$props) $$invalidate(1, items = $$props.items);
if ('open' in $$props) $$invalidate(2, open = $$props.open);
if ('disabled' in $$props) $$invalidate(7, disabled = $$props.disabled);

@@ -1692,7 +1709,13 @@ if ('maskClosable' in $$props) $$invalidate(5, maskClosable = $$props.maskClosable);

$$self.$$.update = () => {
if ($$self.$$.dirty[0] & /*items, activeKey*/ 3) {
$$invalidate(8, selectedIndex = items.findIndex(v => v.key === activeKey));
}
};
return [
activeKey,
items,
open,
className,
selectedIndex,
caption,

@@ -1702,8 +1725,12 @@ maskClosable,

disabled,
selectedIndex,
modalHeight,
tab,
tabName,
handleTabChange,
handleSelectOption,
handleTabChange,
handleReset,
handleOk,
reset,
ul0_binding,
bottomsheet_open_binding,

@@ -1718,15 +1745,29 @@ bottomsheet_height_binding

init(this, options, instance, create_fragment, safe_not_equal, {
class: 2,
selected: 3,
items: 0,
open: 1,
caption: 4,
disabled: 7,
maskClosable: 5,
closable: 6
});
init(
this,
options,
instance,
create_fragment,
safe_not_equal,
{
class: 3,
activeKey: 0,
caption: 4,
items: 1,
open: 2,
disabled: 7,
maskClosable: 5,
closable: 6,
reset: 16
},
null,
[-1, -1]
);
}
get reset() {
return this.$$.ctx[16];
}
}
export { ActionSheet as default };

@@ -1132,4 +1132,4 @@ var ActionSheet = (function () {

const child_ctx = ctx.slice();
child_ctx[18] = list[i].label;
child_ctx[19] = list[i].value;
child_ctx[22] = list[i].label;
child_ctx[23] = list[i].value;

@@ -1140,7 +1140,7 @@ child_ctx[7] = list[i].disabled !== undefined

child_ctx[20] = list[i].selected !== undefined
child_ctx[24] = list[i].selected !== undefined
? list[i].selected
: false;
child_ctx[21] = object_without_properties(list[i], ["label", "value", "disabled", "selected"]);
child_ctx[25] = object_without_properties(list[i], ["label", "value", "disabled", "selected"]);
return child_ctx;

@@ -1151,7 +1151,8 @@ }

const child_ctx = ctx.slice();
child_ctx[24] = list[i];
child_ctx[28] = list[i];
child_ctx[30] = i;
return child_ctx;
}
// (87:6) {#each items as item (item.key)}
// (90:6) {#each items as item, idx (item.key)}
function create_each_block_1(key_1, ctx) {

@@ -1161,8 +1162,8 @@ let li;

let input;
let input_data_json_value;
let input_checked_value;
let t0;
let t1_value = /*item*/ ctx[24].label + "";
let t1_value = /*item*/ ctx[28].label + "";
let t1;
let t2;
let li_data_json_value;

@@ -1179,6 +1180,7 @@ return {

t2 = space();
attr(input, "name", /*tabName*/ ctx[9]);
attr(input, "data-json", input_data_json_value = JSON.stringify({ .../*item*/ ctx[28], options: undefined }));
attr(input, "name", /*tabName*/ ctx[11]);
attr(input, "type", "radio");
input.checked = input_checked_value = /*item*/ ctx[24].selected || false;
attr(li, "data-json", li_data_json_value = JSON.stringify({ .../*item*/ ctx[24], options: undefined }));
input.checked = input_checked_value = /*item*/ ctx[28].selected || false;
toggle_class(label, "resp-action-sheet__tab-item--selected", /*idx*/ ctx[30] == 0 && /*activeKey*/ ctx[0] == "" || /*activeKey*/ ctx[0] === /*item*/ ctx[28].key);
this.first = li;

@@ -1197,10 +1199,14 @@ },

if (dirty & /*items*/ 1 && input_checked_value !== (input_checked_value = /*item*/ ctx[24].selected || false)) {
if (dirty[0] & /*items*/ 2 && input_data_json_value !== (input_data_json_value = JSON.stringify({ .../*item*/ ctx[28], options: undefined }))) {
attr(input, "data-json", input_data_json_value);
}
if (dirty[0] & /*items*/ 2 && input_checked_value !== (input_checked_value = /*item*/ ctx[28].selected || false)) {
input.checked = input_checked_value;
}
if (dirty & /*items*/ 1 && t1_value !== (t1_value = /*item*/ ctx[24].label + "")) set_data(t1, t1_value);
if (dirty[0] & /*items*/ 2 && t1_value !== (t1_value = /*item*/ ctx[28].label + "")) set_data(t1, t1_value);
if (dirty & /*items*/ 1 && li_data_json_value !== (li_data_json_value = JSON.stringify({ .../*item*/ ctx[24], options: undefined }))) {
attr(li, "data-json", li_data_json_value);
if (dirty[0] & /*items, activeKey*/ 3) {
toggle_class(label, "resp-action-sheet__tab-item--selected", /*idx*/ ctx[30] == 0 && /*activeKey*/ ctx[0] == "" || /*activeKey*/ ctx[0] === /*item*/ ctx[28].key);
}

@@ -1214,3 +1220,3 @@ },

// (106:4) {#each items[selectedIndex].options || [] as { label, value, disabled = false, selected = false, ...otherProps }}
// (117:4) {#each items[selectedIndex < 0 ? 0 : selectedIndex].options || [] as { label, value, disabled = false, selected = false, ...otherProps }}
function create_each_block(ctx) {

@@ -1220,2 +1226,3 @@ let li;

let input;
let input_data_json_value;
let input_disabled_value;

@@ -1226,6 +1233,5 @@ let input_value_value;

let div;
let t1_value = /*label*/ ctx[18] + "";
let t1_value = /*label*/ ctx[22] + "";
let t1;
let t2;
let li_data_json_value;

@@ -1242,15 +1248,16 @@ return {

attr(input, "type", "checkbox");
attr(input, "data-json", input_data_json_value = JSON.stringify({
.../*otherProps*/ ctx[25],
label: /*label*/ ctx[22],
value: /*value*/ ctx[23],
selected: /*selected*/ ctx[24],
disabled: /*disabled*/ ctx[7]
}));
input.disabled = input_disabled_value = /*disabled*/ ctx[7];
input.value = input_value_value = /*value*/ ctx[19];
input.checked = input_checked_value = /*selected*/ ctx[20];
input.value = input_value_value = /*value*/ ctx[23];
input.checked = input_checked_value = /*selected*/ ctx[24];
attr(div, "class", "resp-action-sheet__option-label");
attr(li, "class", "resp-action-sheet__option");
attr(li, "data-json", li_data_json_value = JSON.stringify({
.../*otherProps*/ ctx[21],
label: /*label*/ ctx[18],
value: /*value*/ ctx[19],
selected: /*selected*/ ctx[20],
disabled: /*disabled*/ ctx[7]
}));
},

@@ -1267,25 +1274,25 @@ m(target, anchor) {

p(ctx, dirty) {
if (dirty & /*items, selectedIndex*/ 9 && input_disabled_value !== (input_disabled_value = /*disabled*/ ctx[7])) {
if (dirty[0] & /*items, selectedIndex*/ 258 && input_data_json_value !== (input_data_json_value = JSON.stringify({
.../*otherProps*/ ctx[25],
label: /*label*/ ctx[22],
value: /*value*/ ctx[23],
selected: /*selected*/ ctx[24],
disabled: /*disabled*/ ctx[7]
}))) {
attr(input, "data-json", input_data_json_value);
}
if (dirty[0] & /*items, selectedIndex*/ 258 && input_disabled_value !== (input_disabled_value = /*disabled*/ ctx[7])) {
input.disabled = input_disabled_value;
}
if (dirty & /*items, selectedIndex*/ 9 && input_value_value !== (input_value_value = /*value*/ ctx[19])) {
if (dirty[0] & /*items, selectedIndex*/ 258 && input_value_value !== (input_value_value = /*value*/ ctx[23])) {
input.value = input_value_value;
}
if (dirty & /*items, selectedIndex*/ 9 && input_checked_value !== (input_checked_value = /*selected*/ ctx[20])) {
if (dirty[0] & /*items, selectedIndex*/ 258 && input_checked_value !== (input_checked_value = /*selected*/ ctx[24])) {
input.checked = input_checked_value;
}
if (dirty & /*items, selectedIndex*/ 9 && t1_value !== (t1_value = /*label*/ ctx[18] + "")) set_data(t1, t1_value);
if (dirty & /*items, selectedIndex*/ 9 && li_data_json_value !== (li_data_json_value = JSON.stringify({
.../*otherProps*/ ctx[21],
label: /*label*/ ctx[18],
value: /*value*/ ctx[19],
selected: /*selected*/ ctx[20],
disabled: /*disabled*/ ctx[7]
}))) {
attr(li, "data-json", li_data_json_value);
}
if (dirty[0] & /*items, selectedIndex*/ 258 && t1_value !== (t1_value = /*label*/ ctx[22] + "")) set_data(t1, t1_value);
},

@@ -1298,3 +1305,3 @@ d(detaching) {

// (125:4) <Button variant="primary" {disabled} on:click={handleOk}>
// (139:4) <Button variant="primary" {disabled} on:click={handleOk}>
function create_default_slot_1(ctx) {

@@ -1316,3 +1323,3 @@ let t;

// (74:0) <BottomSheet bind:open bind:height={modalHeight} class={className} {maskClosable} {closable} >
// (73:0) <BottomSheet bind:open bind:height={modalHeight} class={className} {maskClosable} {closable} >
function create_default_slot(ctx) {

@@ -1337,4 +1344,4 @@ let header;

let dispose;
let each_value_1 = /*items*/ ctx[0];
const get_key = ctx => /*item*/ ctx[24].key;
let each_value_1 = /*items*/ ctx[1];
const get_key = ctx => /*item*/ ctx[28].key;

@@ -1347,3 +1354,6 @@ for (let i = 0; i < each_value_1.length; i += 1) {

let each_value = /*items*/ ctx[0][/*selectedIndex*/ ctx[3]].options || [];
let each_value = /*items*/ ctx[1][/*selectedIndex*/ ctx[8] < 0
? 0
: /*selectedIndex*/ ctx[8]].options || [];
let each_blocks = [];

@@ -1364,3 +1374,3 @@

button.$on("click", /*handleOk*/ ctx[13]);
button.$on("click", /*handleOk*/ ctx[15]);

@@ -1398,3 +1408,3 @@ return {

attr(ul1, "class", "resp-action-sheet__body");
set_style(ul1, "height", /*modalHeight*/ ctx[8] - 200 + "px");
set_style(ul1, "height", /*modalHeight*/ ctx[9] - 180 + "px");
attr(footer, "class", "resp-action-sheet__footer");

@@ -1416,2 +1426,3 @@ },

/*ul0_binding*/ ctx[17](ul0);
insert(target, t4, anchor);

@@ -1431,5 +1442,5 @@ insert(target, ul1, anchor);

dispose = [
listen(span, "click", /*handleReset*/ ctx[12]),
listen(ul0, "change", /*handleTabChange*/ ctx[11]),
listen(ul1, "change", /*handleSelectOption*/ ctx[10])
listen(span, "click", /*handleReset*/ ctx[14]),
listen(ul0, "change", /*handleTabChange*/ ctx[12]),
listen(ul1, "change", /*handleSelectOption*/ ctx[13])
];

@@ -1441,11 +1452,14 @@

p(ctx, dirty) {
if (!current || dirty & /*caption*/ 16) set_data(t0, /*caption*/ ctx[4]);
if (!current || dirty[0] & /*caption*/ 16) set_data(t0, /*caption*/ ctx[4]);
if (dirty & /*JSON, items, undefined, tabName*/ 513) {
each_value_1 = /*items*/ ctx[0];
if (dirty[0] & /*items, activeKey, tabName*/ 2051) {
each_value_1 = /*items*/ ctx[1];
each_blocks_1 = update_keyed_each(each_blocks_1, dirty, get_key, 1, ctx, each_value_1, each0_lookup, ul0, destroy_block, create_each_block_1, null, get_each_context_1);
}
if (dirty & /*JSON, items, selectedIndex*/ 9) {
each_value = /*items*/ ctx[0][/*selectedIndex*/ ctx[3]].options || [];
if (dirty[0] & /*items, selectedIndex*/ 258) {
each_value = /*items*/ ctx[1][/*selectedIndex*/ ctx[8] < 0
? 0
: /*selectedIndex*/ ctx[8]].options || [];
let i;

@@ -1472,10 +1486,10 @@

if (!current || dirty & /*modalHeight*/ 256) {
set_style(ul1, "height", /*modalHeight*/ ctx[8] - 200 + "px");
if (!current || dirty[0] & /*modalHeight*/ 512) {
set_style(ul1, "height", /*modalHeight*/ ctx[9] - 180 + "px");
}
const button_changes = {};
if (dirty & /*disabled*/ 128) button_changes.disabled = /*disabled*/ ctx[7];
if (dirty[0] & /*disabled*/ 128) button_changes.disabled = /*disabled*/ ctx[7];
if (dirty & /*$$scope*/ 134217728) {
if (dirty[1] & /*$$scope*/ 1) {
button_changes.$$scope = { dirty, ctx };

@@ -1502,2 +1516,3 @@ }

/*ul0_binding*/ ctx[17](null);
if (detaching) detach(t4);

@@ -1522,11 +1537,11 @@ if (detaching) detach(ul1);

function bottomsheet_open_binding(value) {
/*bottomsheet_open_binding*/ ctx[14](value);
/*bottomsheet_open_binding*/ ctx[18](value);
}
function bottomsheet_height_binding(value) {
/*bottomsheet_height_binding*/ ctx[15](value);
/*bottomsheet_height_binding*/ ctx[19](value);
}
let bottomsheet_props = {
class: /*className*/ ctx[2],
class: /*className*/ ctx[3],
maskClosable: /*maskClosable*/ ctx[5],

@@ -1538,8 +1553,8 @@ closable: /*closable*/ ctx[6],

if (/*open*/ ctx[1] !== void 0) {
bottomsheet_props.open = /*open*/ ctx[1];
if (/*open*/ ctx[2] !== void 0) {
bottomsheet_props.open = /*open*/ ctx[2];
}
if (/*modalHeight*/ ctx[8] !== void 0) {
bottomsheet_props.height = /*modalHeight*/ ctx[8];
if (/*modalHeight*/ ctx[9] !== void 0) {
bottomsheet_props.height = /*modalHeight*/ ctx[9];
}

@@ -1559,21 +1574,21 @@

},
p(ctx, [dirty]) {
p(ctx, dirty) {
const bottomsheet_changes = {};
if (dirty & /*className*/ 4) bottomsheet_changes.class = /*className*/ ctx[2];
if (dirty & /*maskClosable*/ 32) bottomsheet_changes.maskClosable = /*maskClosable*/ ctx[5];
if (dirty & /*closable*/ 64) bottomsheet_changes.closable = /*closable*/ ctx[6];
if (dirty[0] & /*className*/ 8) bottomsheet_changes.class = /*className*/ ctx[3];
if (dirty[0] & /*maskClosable*/ 32) bottomsheet_changes.maskClosable = /*maskClosable*/ ctx[5];
if (dirty[0] & /*closable*/ 64) bottomsheet_changes.closable = /*closable*/ ctx[6];
if (dirty & /*$$scope, disabled, modalHeight, items, selectedIndex, caption*/ 134218137) {
if (dirty[0] & /*disabled, modalHeight, items, selectedIndex, tab, activeKey, caption*/ 1939 | dirty[1] & /*$$scope*/ 1) {
bottomsheet_changes.$$scope = { dirty, ctx };
}
if (!updating_open && dirty & /*open*/ 2) {
if (!updating_open && dirty[0] & /*open*/ 4) {
updating_open = true;
bottomsheet_changes.open = /*open*/ ctx[1];
bottomsheet_changes.open = /*open*/ ctx[2];
add_flush_callback(() => updating_open = false);
}
if (!updating_height && dirty & /*modalHeight*/ 256) {
if (!updating_height && dirty[0] & /*modalHeight*/ 512) {
updating_height = true;
bottomsheet_changes.height = /*modalHeight*/ ctx[8];
bottomsheet_changes.height = /*modalHeight*/ ctx[9];
add_flush_callback(() => updating_height = false);

@@ -1602,10 +1617,23 @@ }

let { class: className = "" } = $$props;
let { selected: selectedIndex = 0 } = $$props;
let selectedIndex = 0;
let modalHeight = 0;
let { activeKey = "" } = $$props;
let { caption = "" } = $$props;
let { items = [] } = $$props;
let { open = false } = $$props;
let { caption = "" } = $$props;
let { disabled = false } = $$props;
let { maskClosable = true } = $$props;
let { closable = true } = $$props;
const reset = () => {
$$invalidate(1, items = items.map(item => {
if (item.options) {
item.options = item.options.map(v => Object.assign(Object.assign({}, v), { selected: false }));
}
return item;
}));
};
let tab;
const tabName = `as_${Math.floor(Math.random() * Date.now())}`;

@@ -1617,49 +1645,31 @@

const handleSelectOption = e => {
const handleTabChange = e => {
const el = findElement(e);
if (!el) return;
const item = JSON.parse(el.dataset.json);
const { value, selected } = item;
const { options = [] } = items[selectedIndex];
const idx = options.findIndex(v => v.value === value);
if (idx < 1) return;
if (selected) {
options[idx].selected = false;
} else {
options[idx].selected = true;
}
$$invalidate(0, items[selectedIndex].options = options, items);
$$invalidate(0, items = [...items]);
dispatch("valuechange", { option: options[idx] });
const { key } = item;
const idx = items.findIndex(v => v.key === key);
if (idx < 0) return;
const { x } = el.parentNode.getBoundingClientRect();
tab && tab.scrollTo(x - 15, 0);
$$invalidate(0, activeKey = key);
dispatch("tabchange", { activeKey, item });
};
const handleTabChange = e => {
const handleSelectOption = e => {
const el = findElement(e);
if (!el) return;
const item = JSON.parse(el.dataset.json);
const { key } = item;
const idx = items.findIndex(v => v.key === key);
if (idx < 1) return;
if (el.checked) {
$$invalidate(0, items[idx].selected = true, items);
} else {
$$invalidate(0, items[idx].selected = false, items);
}
$$invalidate(0, items = [...items]);
dispatch("tabchange", { key, item });
const { value } = item;
const { options = [] } = items[selectedIndex];
const idx = options.findIndex(v => v.value === value);
if (idx < 0) return;
options[idx].selected = el.checked;
$$invalidate(1, items[selectedIndex].options = options, items);
$$invalidate(1, items = [...items]);
dispatch("valuechange", { activeKey, option: options[idx] });
};
const handleReset = () => {
$$invalidate(0, items = items.map(item => {
if (item.options) {
item.options = item.options.map(v => Object.assign(Object.assign({}, v), { selected: false }));
}
return item;
}));
reset();
dispatch("reset", {});

@@ -1669,8 +1679,15 @@ };

const handleOk = () => {
dispatch("ok", {});
dispatch("ok", { activeKey, values: [] });
};
function ul0_binding($$value) {
binding_callbacks[$$value ? 'unshift' : 'push'](() => {
tab = $$value;
$$invalidate(10, tab);
});
}
function bottomsheet_open_binding(value) {
open = value;
$$invalidate(1, open);
$$invalidate(2, open);
}

@@ -1680,11 +1697,11 @@

modalHeight = value;
$$invalidate(8, modalHeight);
$$invalidate(9, modalHeight);
}
$$self.$$set = $$props => {
if ('class' in $$props) $$invalidate(2, className = $$props.class);
if ('selected' in $$props) $$invalidate(3, selectedIndex = $$props.selected);
if ('items' in $$props) $$invalidate(0, items = $$props.items);
if ('open' in $$props) $$invalidate(1, open = $$props.open);
if ('class' in $$props) $$invalidate(3, className = $$props.class);
if ('activeKey' in $$props) $$invalidate(0, activeKey = $$props.activeKey);
if ('caption' in $$props) $$invalidate(4, caption = $$props.caption);
if ('items' in $$props) $$invalidate(1, items = $$props.items);
if ('open' in $$props) $$invalidate(2, open = $$props.open);
if ('disabled' in $$props) $$invalidate(7, disabled = $$props.disabled);

@@ -1695,7 +1712,13 @@ if ('maskClosable' in $$props) $$invalidate(5, maskClosable = $$props.maskClosable);

$$self.$$.update = () => {
if ($$self.$$.dirty[0] & /*items, activeKey*/ 3) {
$$invalidate(8, selectedIndex = items.findIndex(v => v.key === activeKey));
}
};
return [
activeKey,
items,
open,
className,
selectedIndex,
caption,

@@ -1705,8 +1728,12 @@ maskClosable,

disabled,
selectedIndex,
modalHeight,
tab,
tabName,
handleTabChange,
handleSelectOption,
handleTabChange,
handleReset,
handleOk,
reset,
ul0_binding,
bottomsheet_open_binding,

@@ -1721,13 +1748,27 @@ bottomsheet_height_binding

init(this, options, instance, create_fragment, safe_not_equal, {
class: 2,
selected: 3,
items: 0,
open: 1,
caption: 4,
disabled: 7,
maskClosable: 5,
closable: 6
});
init(
this,
options,
instance,
create_fragment,
safe_not_equal,
{
class: 3,
activeKey: 0,
caption: 4,
items: 1,
open: 2,
disabled: 7,
maskClosable: 5,
closable: 6,
reset: 16
},
null,
[-1, -1]
);
}
get reset() {
return this.$$.ctx[16];
}
}

@@ -1734,0 +1775,0 @@

{
"name": "@responsive-ui/action-sheet",
"version": "1.0.9-alpha.6",
"version": "1.0.9-alpha.7",
"description": "An action sheet component of responsive-ui.",

@@ -52,3 +52,3 @@ "author": "Si3nLoong <sianloong90@gmail.com> (https://github.com/si3nloong)",

},
"gitHead": "5badb89ceef51b3b3240ed8b61a7fbdbb65a0ab0"
"gitHead": "45ef5357e3fbc1406e6837b67e7ee17873f1fa3c"
}
import { SvelteComponent } from "svelte";
import type { SvelteComponentTyped } from "svelte/internal";
type ActionSheetOption = {
export type ActionSheetOption = {
label: string;

@@ -9,3 +9,2 @@ value: string;

selected?: boolean;
// nowrap?: boolean;
};

@@ -17,22 +16,37 @@

options: ActionSheetOption[];
selected?: boolean;
}
export interface ActionSheetProps {
class?: string;
activeKey?: string;
caption?: string;
items: ActionSheetItem[];
open?: boolean;
disabled?: boolean;
maskClosable?: boolean;
selected?: number;
disabled?: boolean;
closable?: boolean;
}
export type ActionSheetTabChangeEvent = {
activeKey: string;
item: Omit<ActionSheetItem, "options">;
};
export type ActionSheetValueChangeEvent = {
activeKey: string;
option: ActionSheetActionSheetOption;
};
export type ActionSheetResetEvent = {};
export type ActionSheetOkEvent = {
activeKey: string;
values: string[];
};
export interface ActionSheetEvents {
ok?: CustomEvent<{}>;
reset?: CustomEvent<{}>;
valuechange?: CustomEvent<{ option: ActionSheetOption }>;
tabchange?: CustomEvent<{
key: string;
item: Omit<ActionSheetItem, "options">;
}>;
tabchange?: CustomEvent<ActionSheetTabChangeEvent>;
valuechange?: CustomEvent<ActionSheetValueChangeEvent>;
reset?: CustomEvent<ActionSheetResetEvent>;
ok?: CustomEvent<ActionSheetOkEvent>;
}

@@ -39,0 +53,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc