0.1.90 • Published 2 months ago

duice v0.1.90

Weekly downloads
2
License
LGPL(GNU Lesser G...
Repository
-
Last release
2 months ago

DUICE (Data-binding UI Component Element)

Conception

1. MVC Auto-Binding (between Data Structure and HTML DOM Element)

By using the Object and Array, bidirectional binding processing is performed with HTML DOM Element in charge of presentation of the screen. (It's implemented by Internally it is Proxy and Observer Pattern) When changing the data of Object and Array, the value of the UI DOM element binding was also automatically changed. Conversely, if the user changes the value of the UI DOM Element, the binding Object and Array is automatically changed.

2. Reducing Learning Curve (Only simple HTML and javascript)

If you know only basic HTML format and Javascript, configure it to be able to operate.

3. Pure Javascript Prototype (No Dependency, No Conflict)

This library is developted by just pure javascript. It is oriented towards minimal code, no-dependency and no-conflict. Therefore you can use it with another javascript library together.


Git and Website

Demo Site

References


Object Element

Javascript

const user = new duice.ObjectProxy({
    id: 'apple',
    name: 'Apple'
});

HTML

attributedescription
data-duice-bind="object"Object name to bind
data-duice-property="property of object"Object Property name to bind
data-duice-script="script code"javascript code to execute when element is updated
data-duice-format="data format clause"ex) string('###-###'), number(2), date('yyyy-MM-dd')
<span data-duice-bind="user" data-duice-property="id"></span>
<input type="text" data-duice-bind="user" data-duice-property="name"/>

Test Case

Object Element Test


Array Element

Javascript

const users = new duice.ArrayProxy([
    {id: 'apple', name: 'Apple'},
    {id: 'monkey', name: 'Monkey'},
    {id: 'orange', name: 'Orange'}
]);

HTML

attributedescription
data-duice-bind="array"Object name to bind
data-duice-loop="element name,status name"element object and status variable name
data-duice-script="script code"javascript code to execute when element is updated
<table>
    <tr>
        <th>no</th>
        <th>name</th>
        <th>name</th>
    </tr>
    <tr data-duice-bind="users" data-duice-loop="user,status">
        <td data-duice-bind="status" data-duice-property="count"></td>
        <td data-duice-bind="user" data-duice-property="id"></td>
        <td><input type="text" data-duice-bind="user" data-duice-property="name"/></td>
    </tr>
</table>

Test Case

Array Element Test


Dialog(alert,confirm,prompt,custom dialog)

Javascript

// await style
async function confirmAwait() {
    if(await duice.confirm('<b>Hello~</b>\nThis is confirm message!\nYes or No?')){
        alert(true);
    }else{
        alert(false);
    }
}

// then style
async function confirmThen() {
    duice.confirm('<b>Hello~</b>\nThis is confirm message!\nYes or No?').then((result) =>{
        if(result) {
            alert(true);
        }else{
            alert(false);
        }
    });
}

// custom dialog from HTML Dialog Element
async function openDialog() {
    duice.openDialog(document.getElementById('myDialog')).then(()=>{
        alert('do next');
    });
}

HTML

<dialog id="myDialog">
    <pre>
        Custom Dialog
    </pre>
</dialog>

Test Case

Dialog/Alert/Confirm/Prompt Test


License

LICENSE

Contact

0.1.90

2 months ago

0.1.89

3 months ago

0.1.88

4 months ago

0.1.87

4 months ago

0.1.85

5 months ago

0.1.86

5 months ago

0.1.84

8 months ago

0.1.82

9 months ago

0.1.83

9 months ago

0.1.59

11 months ago

0.1.80

10 months ago

0.1.81

10 months ago

0.1.74

10 months ago

0.1.75

10 months ago

0.1.76

10 months ago

0.1.77

10 months ago

0.1.78

10 months ago

0.1.79

10 months ago

0.1.70

10 months ago

0.1.71

10 months ago

0.1.72

10 months ago

0.1.73

10 months ago

0.1.63

11 months ago

0.1.64

10 months ago

0.1.65

10 months ago

0.1.67

10 months ago

0.1.68

10 months ago

0.1.69

10 months ago

0.1.60

11 months ago

0.1.61

11 months ago

0.1.62

11 months ago

0.1.52

11 months ago

0.1.53

11 months ago

0.1.54

11 months ago

0.1.55

11 months ago

0.1.56

11 months ago

0.1.57

11 months ago

0.1.58

11 months ago

0.1.50

11 months ago

0.1.51

11 months ago

0.1.49

11 months ago

0.1.41

12 months ago

0.1.42

12 months ago

0.1.43

12 months ago

0.1.44

12 months ago

0.1.45

11 months ago

0.1.46

11 months ago

0.1.47

11 months ago

0.1.48

11 months ago

0.1.40

12 months ago

0.1.38

12 months ago

0.1.39

12 months ago

0.1.30

1 year ago

0.1.31

1 year ago

0.1.32

1 year ago

0.1.33

1 year ago

0.1.34

1 year ago

0.1.35

1 year ago

0.1.36

1 year ago

0.1.37

1 year ago

0.1.27

1 year ago

0.1.28

1 year ago

0.1.29

1 year ago

0.1.20

1 year ago

0.1.21

1 year ago

0.1.22

1 year ago

0.1.23

1 year ago

0.1.24

1 year ago

0.1.25

1 year ago

0.1.26

1 year ago

0.1.17

1 year ago

0.1.18

1 year ago

0.1.10

1 year ago

0.1.11

1 year ago

0.1.12

1 year ago

0.1.13

1 year ago

0.1.14

1 year ago

0.1.15

1 year ago

0.1.16

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.9

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago